diff options
author | Patrick Strateman <patrick.strateman@gmail.com> | 2016-04-23 22:21:52 -0700 |
---|---|---|
committer | Patrick Strateman <patrick.strateman@gmail.com> | 2016-04-24 01:30:47 -0700 |
commit | fb26bf0ea3822638b10a783f054c280fc053a2b5 (patch) | |
tree | 1b6e5fd2fac54fa186c10e4fa028753d220ed37a /src/addrman.h | |
parent | 04a29373571d44be36bd099c3b3ec3cda89e99d1 (diff) |
CAddrMan::Deserialize handle corrupt serializations better.
Diffstat (limited to 'src/addrman.h')
-rw-r--r-- | src/addrman.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/addrman.h b/src/addrman.h index 4f3de8d7c5..3085450450 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -350,6 +350,14 @@ public: 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. for (int n = 0; n < nNew; n++) { CAddrInfo &info = mapInfo[n]; |