1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-16 04:39:03 +00:00

Split apart the calls to inet_ntoa from r22818; we can't call it twice

in the same statement or the static buffer is overwritten.
This commit is contained in:
david
2011-03-30 21:07:37 +00:00
parent 61e8dfc660
commit 58e9346684

View File

@@ -1517,11 +1517,15 @@ static struct dnet_collector_route_nfo *sysroutes_dnet_find_interfaces(struct dn
i = 0;
while (i < dcrn->numroutes) {
if (dcrn->routes[i].device == NULL) {
char destbuf[INET6_ADDRSTRLEN];
char gwbuf[INET6_ADDRSTRLEN];
struct in_addr ia;
ia.s_addr = dcrn->routes[i].dest;
strncpy(destbuf, inet_ntoa(ia), sizeof(destbuf));
strncpy(gwbuf, inet_ntoa(dcrn->routes[i].gw), sizeof(gwbuf));
netutil_error("WARNING: Unable to find appropriate interface for system route to %s/%u gw %s",
inet_ntoa(ia), dcrn->routes[i].netmask, inet_ntoa(dcrn->routes[i].gw));
destbuf, dcrn->routes[i].netmask, gwbuf);
/* Remove this entry from the table. */
memmove(dcrn->routes + i, dcrn->routes + i + 1, sizeof(dcrn->routes[0]) * (dcrn->numroutes - i - 1));
dcrn->numroutes--;