Skip to content

Commit

Permalink
Merge #7932: CAddrMan::Deserialize handle corrupt serializations better.
Browse files Browse the repository at this point in the history
fb26bf0 CAddrMan::Deserialize handle corrupt serializations better. (Patrick Strateman)
  • Loading branch information
laanwj authored and sickpig committed May 2, 2017
1 parent 16969f5 commit 6239eb6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ class CAddrMan
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];
Expand Down

0 comments on commit 6239eb6

Please sign in to comment.