aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2016-04-23 22:21:52 -0700
committerPatrick Strateman <patrick.strateman@gmail.com>2016-04-24 01:30:47 -0700
commitfb26bf0ea3822638b10a783f054c280fc053a2b5 (patch)
tree1b6e5fd2fac54fa186c10e4fa028753d220ed37a /src/addrman.h
parent04a29373571d44be36bd099c3b3ec3cda89e99d1 (diff)
CAddrMan::Deserialize handle corrupt serializations better.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h8
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];