Subject: lib/3913: scandir(3) fails to set d_type
To: None <gnats-bugs@gnats.netbsd.org>
From: None <giles@nemeton.com.au>
List: netbsd-bugs
Date: 07/23/1997 23:57:32
>Number: 3913
>Category: lib
>Synopsis: scandir(3) failes to set d_type
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jul 23 17:05:01 1997
>Last-Modified:
>Originator: Giles Lean
>Organization:
Giles Lean <giles@nemeton.com.au> +61 3 9480 2118
Nemeton Pty. Ltd. fax +61 3 9480 1771
PGP Fingerprint (DA68EE41) 9F FB 28 37 81 F2 AC F3 8A B0 37 E5 73 CF 39 E7
>Release: 1.1
>Environment:
System: NetBSD topaz.nemeton.com.au 1.1 NetBSD 1.1 (TOPAZ.DISKLESS) #0: Sun Mar 23 23:48:25 EST 1997 giles@nemeton.com.au:/usr/src/sys/arch/i386/compile/TOPAZ.DISKLESS i386
>Description:
Code that uses scandir(3) and relies on d_type is in for a shock.
This bug is still in -current as of the date of the PR, but has
been fixed in FreeBSD.
>How-To-Repeat:
Access to d_type when using scandir() will access uninitialised
memory.
Found when using CTM on NetBSD.
>Fix:
*** src/lib/libc/gen/scandir.c-old Thu Jul 24 09:51:58 1997
--- src/lib/libc/gen/scandir.c Thu Jul 24 09:53:46 1997
***************
*** 111,116 ****
--- 111,117 ----
return(-1);
p->d_ino = d->d_ino;
p->d_reclen = d->d_reclen;
+ p->d_type = d->d_type;
p->d_namlen = d->d_namlen;
bcopy(d->d_name, p->d_name, p->d_namlen + 1);
/*
>Audit-Trail:
>Unformatted: