From owner-freebsd-bugs@FreeBSD.ORG Thu May 29 05:50:22 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B09A137B401 for ; Thu, 29 May 2003 05:50:22 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE4B343FE0 for ; Thu, 29 May 2003 05:50:21 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4TCoLUp027053 for ; Thu, 29 May 2003 05:50:21 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4TCoLsM027051; Thu, 29 May 2003 05:50:21 -0700 (PDT) Resent-Date: Thu, 29 May 2003 05:50:21 -0700 (PDT) Resent-Message-Id: <200305291250.h4TCoLsM027051@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "David P.Reese Jr." Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D0BC237B401 for ; Thu, 29 May 2003 05:49:15 -0700 (PDT) Received: from gold.he.net (gold.he.net [216.218.149.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2C80E43FB1 for ; Thu, 29 May 2003 05:49:15 -0700 (PDT) (envelope-from daver@gomerbud.com) Received: from tombstone.localnet.gomerbud.com (adsl-64-161-56-54.dsl.snlo01.pacbell.net [64.161.56.54]) by gold.he.net (8.8.6p2003-03-31/8.8.2) with ESMTP id FAA11997 for ; Thu, 29 May 2003 05:49:13 -0700 Received: by tombstone.localnet.gomerbud.com (Postfix, from userid 1001) id EF66D395; Thu, 29 May 2003 05:49:13 -0700 (PDT) Message-Id: <20030529124913.EF66D395@tombstone.localnet.gomerbud.com> Date: Thu, 29 May 2003 05:49:13 -0700 (PDT) From: "David P.Reese Jr." To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/52783: [PATCH] libmap.conf constraints are not parsed properly X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "David P.Reese Jr." List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2003 12:50:23 -0000 >Number: 52783 >Category: bin >Synopsis: [PATCH] libmap.conf constraints are not parsed properly >Confidential: no >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 29 05:50:21 PDT 2003 >Closed-Date: >Last-Modified: >Originator: David P. Reese Jr. >Release: FreeBSD 5.1-BETA i386 >Organization: >Environment: System: FreeBSD tombstone.localnet.gomerbud.com 5.1-BETA FreeBSD 5.1-BETA #16: Tue May 27 23:53:27 PDT 2003 root@tombstone.localnet.gomerbud.com:/tmp/obj/usr/src/sys/TOMBSTONE i386 rtld-elf built with -DWITH_LIBMAP >Description: When libmap.conf is parsed and a constraint is encountered, it is possible for the parser to fail. The parsing routine is contained in libmap.c:lm_init(). The parser uses the character pointer cp to walk each line in the config file. After encountering a ']', the character is nulled and cp is incremented. The following characters are then walked using isspace() in a while loop. If non whitespace is encountered, the while loop incorrectly increments cp past that character before iseol() is called. >How-To-Repeat: Change the #if 0 on line 170 of libmap.conf to an #if 1 to watch the debugging output. Build rtld-elf with -DWITH_LIBMAP and run any dynamically linked binary using the following /etc/libmap.conf: libc_r.so.5 libc_r.so.5 libc_r.so libc_r.so [/usr/local/bin/mplayer] libc_r.so.5 libc_r.so.5 libc_r.so libc_r.so [mplayer] libc_r.so.5 libc_r.so.5 libc_r.so libc_r.so [/usr/X11R6/bin/xine] libc_r.so.5 libc_r.so.5 libc_r.so libc_r.so [xine] libc_r.so.5 libc_r.so.5 libc_r.so libc_r.so The debugging output should look something like: lm_add("$DEFAULT$", "libc_r.so.5", "libc_r.so.5") lm_add("$DEFAULT$", "libc_r.so", "libc_r.so") lm_add("ibc_r.so.5", "libc_r.so.5", "libc_r.so.5") lm_add("ibc_r.so", "libc_r.so", "libc_r.so") lm_add("mplayer", "libc_r.so.5", "libc_r.so.5") lm_add("mplayer", "libc_r.so", "libc_r.so") lm_add("ibc_r.so.5", "libc_r.so.5", "libc_r.so.5") lm_add("ibc_r.so", "libc_r.so", "libc_r.so") lm_add("ibc_r.so.5", "libc_r.so.5", "libc_r.so.5") lm_add("ibc_r.so", "libc_r.so", "libc_r.so") >Fix: --- libmap.diff begins here --- Index: libmap.c =================================================================== RCS file: /home/daver/cvs-freebsd/src/libexec/rtld-elf/libmap.c,v retrieving revision 1.4 diff -u -r1.4 libmap.c --- libmap.c 19 May 2003 07:10:12 -0000 1.4 +++ libmap.c 29 May 2003 12:26:03 -0000 @@ -93,7 +93,7 @@ * There should be nothing except whitespace or comment * from this point to the end of the line. */ - while(isspace(*cp++)); + while(isspace(*cp)) *cp++; if (!iseol(*cp)) continue; strcpy(prog, p); --- libmap.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: