aboutsummaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
authorRobert Backhaus <robbak@robbak.com>2013-05-29 10:33:36 +1000
committerRobert Backhaus <robbak@robbak.com>2013-05-29 12:12:33 +1000
commit98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1 (patch)
treee8465162aa177b50cb2eaa384af64375aae6fda0 /src/db.cpp
parent09e437ba4e5cb7fcc53020c1ceb2451e0ff1606b (diff)
downloadbitcoin-98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1.tar.xz
Don't attempt to resize vector to negative size.
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 3133d99bf8..fd4c67d552 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -541,6 +541,8 @@ bool CAddrDB::Read(CAddrMan& addr)
// use file size to size memory buffer
int fileSize = GetFilesize(filein);
int dataSize = fileSize - sizeof(uint256);
+ //Don't try to resize to a negative number if file is small
+ if ( dataSize < 0 ) dataSize = 0;
vector<unsigned char> vchData;
vchData.resize(dataSize);
uint256 hashIn;