Date: Thu, 2 May 2002 15:15:40 -0500 (CDT) From: Scott Bertilson <scott@nts.umn.edu> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Scott Bertilson <scott@nts.umn.edu> Subject: bin/37680: misuse of inet_aton() in $FreeBSD: src/usr.sbin/portmap/portmap.c,v 1.10.2.1 Message-ID: <200205022015.g42KFeh20323@ssb2.nts.umn.edu>
next in thread | raw e-mail | index | archive | help
>Number: 37680 >Category: bin >Synopsis: misuse of inet_aton() in $FreeBSD: src/usr.sbin/portmap/portmap.c,v 1.10.2.1 >Confidential: yes >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 02 13:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Scott Bertilson >Release: FreeBSD 4.4-RELEASE-p1 i386 >Organization: University of Minnesota / OIT >Environment: System: FreeBSD ssb2.nts.umn.edu 4.4-RELEASE-p1 FreeBSD 4.4-RELEASE-p1 #13: Tue Apr 30 19:16:22 CDT 2002 scott@ssb2.nts.umn.edu:/home/src/sys/compile/SSB i386 >Description: at line 175: if (inet_aton(hosts[nhosts], &addr.sin_addr) < 0) { >How-To-Repeat: Enter hostname instead of IP for "-h". Results in "address already in use" because it attempts to rebind 127.0.0.1. >Fix: Change to conform to documented behavior of inet_aton() returning 0 for failure, 1 for success: if (!inet_aton(hosts[nhosts], &addr.sin_addr)) { Looks like it is also misused in $FreeBSD: src/usr.sbin/pppd/options.c,v 1.20.2.1 at line 1815: if ((inet_aton(*argv, &mask)) == -1 || (netmask & ~mask.s_addr)) { which should be: if ((inet_aton(*argv, &mask)) != 1 || (netmask & ~mask.s_addr)) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205022015.g42KFeh20323>