From stolz@i2.informatik.rwth-aachen.de  Thu Aug 28 09:27:31 2003
Return-Path: <stolz@i2.informatik.rwth-aachen.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2B52A16A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 09:27:31 -0700 (PDT)
Received: from atlas.informatik.rwth-aachen.de (atlas.Informatik.RWTH-Aachen.DE [137.226.194.2])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A243C43FF2
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 09:27:27 -0700 (PDT)
	(envelope-from stolz@i2.informatik.rwth-aachen.de)
Received: from menelaos.informatik.rwth-aachen.de (menelaos.Informatik.RWTH-Aachen.DE [137.226.194.73])
	by atlas.informatik.rwth-aachen.de (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) with ESMTP id h7SGRQL04060
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 18:27:26 +0200
Received: (from stolz@localhost)
	by menelaos.informatik.rwth-aachen.de (8.12.9/8.12.9/Submit) id h7SGRQ5s040767;
	Thu, 28 Aug 2003 18:27:26 +0200 (CEST)
	(envelope-from stolz)
Message-Id: <200308281627.h7SGRQ5s040767@menelaos.informatik.rwth-aachen.de>
Date: Thu, 28 Aug 2003 18:27:26 +0200 (CEST)
From: Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
Reply-To: Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] /usr/bin/make segfaults on unreadable "."
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         56087
>Category:       bin
>Synopsis:       [patch] /usr/bin/make segfaults on unreadable "."
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 28 09:30:06 PDT 2003
>Closed-Date:    Wed Oct 08 01:14:47 PDT 2003
>Last-Modified:  Wed Oct 08 01:14:47 PDT 2003
>Originator:     Volker Stolz
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Lehrstuhl fr 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@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@menelaos [18:23:37]> mkdir foo
tmp@menelaos [18:23:40]> cd foo
foo@menelaos [18:23:47]> chmod a= .
foo@menelaos [18:23:50]> make
Segmentation fault

After applying the patch:

foo@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:
Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Fri Oct 3 15:10:23 PDT 2003 
Responsible-Changed-Why:  
This bug only affects RELENG_4.  HEAD got this bug automatically 
fixed some time ago when Juli cleaned up different spelling of NULL. 

I will take care of committing your patch to RELENG_4. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56087 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Wed Oct 8 01:14:25 PDT 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56087 
>Unformatted:
