Don't attempt to resize vector to negative size.

This commit is contained in:
Robert Backhaus
2013-05-29 10:33:36 +10:00
committed by Wladimir J. van der Laan
parent 27e35bf840
commit df0f6d020a

View File

@@ -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;