diff --git a/src/db.cpp b/src/db.cpp index da20d362b65..2bda0659ba6 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 vchData; vchData.resize(dataSize); uint256 hashIn;