From 9bc09ef2cca4c3b4dbee81b07b03403dc644b96f Mon Sep 17 00:00:00 2001 From: ejlbell Date: Mon, 14 Jan 2008 15:16:50 +0000 Subject: [PATCH] Fixed an integer overflow in the dns caching code that caused nmap to loop infinitely once it had expunging the cache of older entries. --- nmap_dns.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nmap_dns.cc b/nmap_dns.cc index 714ad1314..6984e118f 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -1041,7 +1041,8 @@ static void addto_etchosts(u32 ip, const char *hname) { for(i = 0; i < HASH_TABLE_SIZE; i++) { while((it = find_if(etchosts[i].begin(), etchosts[i].end(), remove_and_age)) != etchosts[i].end()) { etchosts[i].erase(it); - total_size--; + if((total_size--) < HASH_TABLE_SIZE/2) + break; } } }