diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-05-18 11:52:01 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-05-18 11:53:48 +0200 |
commit | ed749bdb648046fdaff232cc1870c6163e57c23f (patch) | |
tree | d28558495e64647a1bc59229a3134d439a869bfc | |
parent | 457b9df6b595d11736557fec28ec27a8b2dba3e2 (diff) | |
parent | fb26bf0ea3822638b10a783f054c280fc053a2b5 (diff) |
Merge #7932: CAddrMan::Deserialize handle corrupt serializations better.
fb26bf0 CAddrMan::Deserialize handle corrupt serializations better. (Patrick Strateman)
-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]; |