--- nmap-4.65/tcpip.cc +++ nmap-4.65/tcpip.cc @@ -2924,8 +2924,8 @@ struct sys_route *getsysroutes(int *howmany) { ifaces = getinterfaces(&numifaces); /* First let us try Linux-style /proc/net/route */ routefp = fopen("/proc/net/route", "r"); - if (routefp) { - (void) fgets(buf, sizeof(buf), routefp); /* Kill the first line (column headers) */ + /* Kill the first line (column headers) */ + if (routefp && fgets(buf, sizeof(buf), routefp)) { while(fgets(buf,sizeof(buf), routefp)) { p = strtok(buf, " \t\n"); if (!p) {