seekdir dereferences null

Joel Sherrill joel.sherrill@oarcorp.com
Fri Dec 5 08:39:00 GMT 2008


Howland Craig D (Craig) wrote:
> The same bug of not checking for dirp being NULL also seems to be in
> telldir (in the same file, of course).  (_cleanupdir does not check,
> either, but a cursory examination says that it probably does not
> matter, as it would not be dereferenced.)
>   
Thanks for the feedback.  You spotting another one made
me nervous so I went through *dir.c in posix and found a
few more cases.  Attached is a new patch.

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

    * libc/posix/closedir.c, libc/posix/readdir.c,
    libc/posix/scandir.c, libc/posix/telldir.c: Check for NULL pointers.

> 				Craig Howland 
>
> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
> On Behalf Of Joel Sherrill
> Sent: Wednesday, December 03, 2008 3:47 PM
> To: newlib@sources.redhat.com
> Subject: 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: nullchecks.diff
Type: text/x-patch
Size: 2023 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20081205/0f3f7606/attachment.bin>


More information about the Newlib mailing list