diff options
author | Robert Backhaus <robbak@robbak.com> | 2013-05-29 10:33:36 +1000 |
---|---|---|
committer | Robert Backhaus <robbak@robbak.com> | 2013-05-29 12:12:33 +1000 |
commit | 98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1 (patch) | |
tree | e8465162aa177b50cb2eaa384af64375aae6fda0 /src | |
parent | 09e437ba4e5cb7fcc53020c1ceb2451e0ff1606b (diff) |
Don't attempt to resize vector to negative size.
Diffstat (limited to 'src')
-rw-r--r-- | src/db.cpp | 2 |
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; |