1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

o Fixed the NmapArpCache so that it actually works. Previously, Nmap

was always falling back to the system ARP cache. Of course this
  raises the question of whether NmapArpCache is needed in the first
  place. [Daniel Roethlisberger]
This commit is contained in:
fyodor
2008-04-14 23:55:25 +00:00
parent 10899aba9b
commit f2938a2d37
2 changed files with 8 additions and 2 deletions

View File

@@ -2153,9 +2153,9 @@ static bool NmapArpCache(int command, struct sockaddr_storage *ss, u8 *mac) {
if (ArpCacheSz == ArpCapacity) {
if (ArpCapacity == 0) ArpCapacity = 32;
else ArpCapacity <<= 2;
Cache = (struct ArpCache *) safe_realloc(Cache,
ArpCapacity * sizeof(struct ArpCache));
}
Cache = (struct ArpCache *) safe_realloc(Cache,
ArpCapacity * sizeof(struct ArpCache));
/* Ensure that it isn't already there ... */
for(i=0; i < ArpCacheSz; i++) {
@@ -2168,6 +2168,7 @@ static bool NmapArpCache(int command, struct sockaddr_storage *ss, u8 *mac) {
/* Add it to the end of the list */
Cache[i].ip = sin->sin_addr.s_addr;
memcpy(Cache[i].mac, mac, 6);
ArpCacheSz++;
return true;
}