Nmap Development mailing list archives
Re: [nmap-svn] r21154 - nbase
From: David Fifield <david () bamsoftware com>
Date: Sun, 21 Nov 2010 19:10:23 -0800
On Sat, Nov 20, 2010 at 11:19:35PM -0800, commit-mailer () insecure org wrote:
Author: kris Date: Sat Nov 20 23:19:34 2010 New Revision: 21154 Log: Fix a bug in sockaddr_storage_cmp() which could cause it to return the wrong value when the address families are different, but typically only with the wrong sign for 1. Practically, it should never return 0 when the sockaddrs differ in family since it would also require the address data for one to match the corresponding data in the other. I found this via code review and upon a quick inspection it doesn't appear to affect any current uses of this function. On most (all?) systems it would only occur if the first sockaddr was inet6 and the second was inet (I would imagine that AF_INET6 > AF_INET is always true, even though these values vary between systems). Doesn't get too much more obscure than that ;) Modified: nbase/nbase_misc.c Modified: nbase/nbase_misc.c ============================================================================== --- nbase/nbase_misc.c (original) +++ nbase/nbase_misc.c Sat Nov 20 23:19:34 2010 @@ -158,7 +158,7 @@ const struct sockaddr_storage *b) { if (a->ss_family < b->ss_family) return -1; - else if (a->ss_family < b->ss_family) + else if (a->ss_family > b->ss_family) return 1; if (a->ss_family == AF_INET) { struct sockaddr_in *sin_a = (struct sockaddr_in *) a;
Nice find. 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:
- Re: [nmap-svn] r21154 - nbase David Fifield (Nov 22)