Browse Source

Don't attempt to resize vector to negative size.

0.8
Robert Backhaus 12 years ago committed by Warren Togami
parent
commit
c2954a117b
  1. 2
      src/db.cpp

2
src/db.cpp

@ -541,6 +541,8 @@ bool CAddrDB::Read(CAddrMan& addr) @@ -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;

Loading…
Cancel
Save