aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Backhaus <robbak@robbak.com>2013-05-29 10:33:36 +1000
committerWladimir J. van der Laan <laanwj@gmail.com>2013-12-05 09:15:41 +0100
commitdf0f6d020a97181d97b5f232e1310b1e982edf36 (patch)
tree79fdd1c31dfb984021b5e9b950773187dd73e54b /src
parent27e35bf84079ebb37ea6b756ad01ea9ed2bdad5f (diff)
Don't attempt to resize vector to negative size.
Diffstat (limited to 'src')
-rw-r--r--src/db.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/db.cpp b/src/db.cpp
index da20d362b6..2bda0659ba 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -540,6 +540,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;