Browse Source

Merge #7932: CAddrMan::Deserialize handle corrupt serializations better.

fb26bf0 CAddrMan::Deserialize handle corrupt serializations better. (Patrick Strateman)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
ed749bdb64
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 8
      src/addrman.h

8
src/addrman.h

@ -350,6 +350,14 @@ public:
nUBuckets ^= (1 << 30); nUBuckets ^= (1 << 30);
} }
if (nNew > ADDRMAN_NEW_BUCKET_COUNT * ADDRMAN_BUCKET_SIZE) {
throw std::ios_base::failure("Corrupt CAddrMan serialization, nNew exceeds limit.");
}
if (nTried > ADDRMAN_TRIED_BUCKET_COUNT * ADDRMAN_BUCKET_SIZE) {
throw std::ios_base::failure("Corrupt CAddrMan serialization, nTried exceeds limit.");
}
// Deserialize entries from the new table. // Deserialize entries from the new table.
for (int n = 0; n < nNew; n++) { for (int n = 0; n < nNew; n++) {
CAddrInfo &info = mapInfo[n]; CAddrInfo &info = mapInfo[n];

Loading…
Cancel
Save