This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/9819] New: readdir segmentation faults when passed NULL
- From: "rbanfield at weogeo dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 4 Feb 2009 17:53:18 -0000
- Subject: [Bug libc/9819] New: readdir segmentation faults when passed NULL
- Reply-to: sourceware-bugzilla at sourceware dot org
readdir from dirent.h produces a segmentation fault if passed a NULL value,
which can easily happen if the result of opendir is not checked against NULL.
#include<dirent.h>
int main()
{
readdir(NULL);
}
According to the man pages: "The readdir() function returns a pointer to a
dirent structure, or NULL if an error occurs or end of the directory stream is
reached. On error, errno is set appropriately."
Fedora 10:
glibc-devel-2.9-3.x86_64
glibc-2.9-3.x86_64
glibc-headers-2.9-3.x86_64
glibc-common-2.9-3.x86_64
--
Summary: readdir segmentation faults when passed NULL
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: rbanfield at weogeo dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=9819
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.