|
|
|
@ -1973,11 +1973,11 @@ bool CAddrDB::Read(CAddrMan& addr)
@@ -1973,11 +1973,11 @@ bool CAddrDB::Read(CAddrMan& addr)
|
|
|
|
|
return error("%s: Failed to open file %s", __func__, pathAddr.string()); |
|
|
|
|
|
|
|
|
|
// use file size to size memory buffer
|
|
|
|
|
int fileSize = boost::filesystem::file_size(pathAddr); |
|
|
|
|
int dataSize = fileSize - sizeof(uint256); |
|
|
|
|
uint64_t fileSize = boost::filesystem::file_size(pathAddr); |
|
|
|
|
uint64_t dataSize = 0; |
|
|
|
|
// Don't try to resize to a negative number if file is small
|
|
|
|
|
if (dataSize < 0) |
|
|
|
|
dataSize = 0; |
|
|
|
|
if (fileSize >= sizeof(uint256)) |
|
|
|
|
dataSize = fileSize - sizeof(uint256); |
|
|
|
|
vector<unsigned char> vchData; |
|
|
|
|
vchData.resize(dataSize); |
|
|
|
|
uint256 hashIn; |
|
|
|
@ -2230,11 +2230,11 @@ bool CBanDB::Read(std::map<CSubNet, int64_t>& banSet)
@@ -2230,11 +2230,11 @@ bool CBanDB::Read(std::map<CSubNet, int64_t>& banSet)
|
|
|
|
|
return error("%s: Failed to open file %s", __func__, pathBanlist.string()); |
|
|
|
|
|
|
|
|
|
// use file size to size memory buffer
|
|
|
|
|
int fileSize = boost::filesystem::file_size(pathBanlist); |
|
|
|
|
int dataSize = fileSize - sizeof(uint256); |
|
|
|
|
uint64_t fileSize = boost::filesystem::file_size(pathBanlist); |
|
|
|
|
uint64_t dataSize = 0; |
|
|
|
|
// Don't try to resize to a negative number if file is small
|
|
|
|
|
if (dataSize < 0) |
|
|
|
|
dataSize = 0; |
|
|
|
|
if (fileSize >= sizeof(uint256)) |
|
|
|
|
dataSize = fileSize - sizeof(uint256); |
|
|
|
|
vector<unsigned char> vchData; |
|
|
|
|
vchData.resize(dataSize); |
|
|
|
|
uint256 hashIn; |
|
|
|
|