This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

Re: seekdir dereferences null


Patch attached this time. :)

Joel Sherrill wrote:
Hi,

Another bug picked up by the RTEMS test suite.

seekdir(NULL, 0) core dumps.

2008-12-03 Joel Sherrill <joel.sherrill@oarcorp.com>

* libc/posix/telldir.c (_seekdir): Do not dereference NULL dirp.



--
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
  Support Available             (256) 722-9985


Index: libc/posix/telldir.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/posix/telldir.c,v
retrieving revision 1.6
diff -u -r1.6 telldir.c
--- libc/posix/telldir.c	27 Nov 2008 21:01:40 -0000	1.6
+++ libc/posix/telldir.c	3 Dec 2008 20:40:40 -0000
@@ -121,6 +121,9 @@
 	struct dirent *dp;
 	extern long lseek();
 
+	if ( !dirp )
+		return;
+
 #ifdef HAVE_DD_LOCK
 	__lock_acquire(dd_hash_lock);
 #endif

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