bin/56087: [patch] /usr/bin/make segfaults on unreadable "."

Volker Stolz stolz at i2.informatik.rwth-aachen.de
Thu Aug 28 09:30:10 PDT 2003


>Number:         56087
>Category:       bin
>Synopsis:       [patch] /usr/bin/make segfaults on unreadable "."
>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 Aug 28 09:30:06 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Volker Stolz
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Lehrstuhl für Informatik II
>Environment:
System: FreeBSD menelaos.informatik.rwth-aachen.de 4.8-STABLE FreeBSD 4.8-STABLE #8: Fri Aug 22 12:08:19 CEST 2003 root at menelaos.informatik.rwth-aachen.de:/usr/obj/usr/src/sys/MENELAOS i386


>Description:
If 'make' is invoked in a restricted directory where it can't read "." it segfaults
instead of printing out an error message because of an off-by-one-error.
(Happens e.g. when running 'sudo make' on an NFS-mounted, root-squashed directory.)
>How-To-Repeat:
tmp at menelaos [18:23:37]> mkdir foo
tmp at menelaos [18:23:40]> cd foo
foo at menelaos [18:23:47]> chmod a= .
foo at menelaos [18:23:50]> make
Segmentation fault

After applying the patch:

foo at menelaos [18:24:11]> /usr/obj/usr/src/usr.bin/make/make
make: cannot open current directory: Permission denied

>Fix:
This patch applies to both -CURRENT & -STABLE:

--- dir.c.orig	Thu Aug 28 18:12:57 2003
+++ dir.c	Thu Aug 28 18:13:27 2003
@@ -225,7 +225,7 @@
      */
     Dir_AddDir (openDirectories, ".");
     dot = (Path *) Lst_DeQueue (openDirectories);
-    if (dot == (Path *) NULL)
+    if (dot == (Path *) NILLNODE)
 	err(1, "cannot open current directory");
 
     /*
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list