This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/9819] New: readdir segmentation faults when passed NULL


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]