From owner-freebsd-bugs Thu May 2 13:21:52 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 69B1037BA5F for ; Thu, 2 May 2002 13:20:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g42KK1D01376; Thu, 2 May 2002 13:20:01 -0700 (PDT) (envelope-from gnats) Received: from nts.nts.umn.edu (nts.nts.umn.edu [128.101.4.1]) by hub.freebsd.org (Postfix) with ESMTP id 246FC37B9A2 for ; Thu, 2 May 2002 13:15:48 -0700 (PDT) Received: from ssb2.nts.umn.edu (ssb2.nts.umn.edu [160.94.7.1]) by nts.nts.umn.edu (8.9.1a/8.9.1) with ESMTP id PAA27691; Thu, 2 May 2002 15:15:42 -0500 (CDT) Received: (from scott@localhost) by ssb2.nts.umn.edu (8.11.6/8.10.2) id g42KFeh20323; Thu, 2 May 2002 15:15:40 -0500 (CDT) Message-Id: <200205022015.g42KFeh20323@ssb2.nts.umn.edu> Date: Thu, 2 May 2002 15:15:40 -0500 (CDT) From: Scott Bertilson Reply-To: Scott Bertilson To: FreeBSD-gnats-submit@FreeBSD.org Cc: Scott Bertilson X-Send-Pr-Version: 3.113 Subject: bin/37680: misuse of inet_aton() in $FreeBSD: src/usr.sbin/portmap/portmap.c,v 1.10.2.1 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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