bin/52783: [PATCH] libmap.conf constraints are not parsed properly

David P.Reese Jr. daver at
Thu May 29 05:50:23 PDT 2003

>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
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 29 05:50:21 PDT 2003
>Originator:     David P. Reese Jr.
>Release:        FreeBSD 5.1-BETA i386
System: FreeBSD 5.1-BETA FreeBSD 5.1-BETA #16: Tue May 27 23:53:27 PDT 2003 root at i386

	rtld-elf built with -DWITH_LIBMAP
	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.

	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:              



	The debugging output should look something like:

lm_add("$DEFAULT$", "", "")
lm_add("$DEFAULT$", "", "")
lm_add("", "", "")
lm_add("", "", "")
lm_add("mplayer", "", "")
lm_add("mplayer", "", "")
lm_add("", "", "")
lm_add("", "", "")
lm_add("", "", "")
lm_add("", "", "")


--- 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 ---


More information about the freebsd-bugs mailing list