Nmap Development mailing list archives
strcasestr in hostcmp
From: David Fifield <david () bamsoftware com>
Date: Wed, 7 Sep 2011 14:14:55 -0700
Hi, The hostcmp function is used to decide whether two hostnames are the same when printing service output. It's defined thus: /* An auxillary function for printserviceinfooutput(). Returns non-zero if a and b are considered the same hostnames. */ static int hostcmp(const char *a, const char *b) { return strcasestr(a, b) ? 1 : 0; } This looks wrong. strcasestr doesn't check whether two strings are the same, it checks whether one string is a substring of another. I've changed it to this: return strcasecmp(a, b) == 0; David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- strcasestr in hostcmp David Fifield (Sep 07)