Subject: bin/2765: fsck_msdos can dump core
To: None <gnats-bugs@gnats.netbsd.org, bugs@openbsd.org>
From: None <david@mono.org>
List: netbsd-bugs
Date: 09/17/1996 15:14:24
>Number:         2765
>Category:       bin
>Synopsis:       msdos can dump core
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 17 07:50:01 1996
>Last-Modified:
>Originator:     David Brownlee
>Organization:
Monochrome (<a href="http://www.mono.org/">Monochrome</a>)
>Release:        1.2_BETA
>Environment:
NetBSD/sparc, IPX
System: NetBSD orwell.southern.net 1.2_BETA NetBSD 1.2_BETA (_SUN4C+FB_) #0: Fri Aug 16 10:40:16 BST 1996 david@electron.mono.org:/usr/src/sys/arch/sparc/compile/_SUN4C+FB_ sparc

>Description:
	The check in realpath will dereference a null pointer.
>How-To-Repeat:
	fsck a damaged filesystem.
>Fix:
	Apply the following patch to usr/sbin/fsck_msdos/dir.c

--- dir.old.c	Tue Sep 17 15:12:43 1996
+++ dir.c	Tue Sep 17 15:12:20 1996
@@ -167,7 +167,7 @@
 		memcpy(cp, np, nl);
 		*--cp = '/';
 	} while (dir = dir->parent);
-	if (dir->parent)
+	if (dir)
 		*--cp = '?';
 	return cp;
 }
>Audit-Trail:
>Unformatted: