[PATCH] IMFS: don't strlen() an unterminated string in IMFS_dir_read().

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 16 19:34:07 UTC 2015


Hm, yes, there is more wrong here. The returned name must be NUL-terminated.  Attached is a patch.  Maybe we should replace the MIN() with a static assertion that IMFS_NAME_MAX < sizeof(((struct dirent *)0)->d_name).

----- Joel Sherrill <joel.sherrill at oarcorp.com> schrieb:
> 
> 
> On 3/16/2015 1:18 PM, Sebastian Huber wrote:
> > Thanks for the fix, I checked it in.
> I commented on the commit. If there is a missing
> NULL at the readdir() point, that means that it
> wasn't put there at either creation or rename.
> 
> Sounds like this is a necessary patch but covering up
> what I think is a bug in both creation and rename since
> they don't appear to account for NULL.
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> 
> -- 
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel.sherrill at 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: 0001-IMFS-NUL-terminate-name-returned-by-readdir.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150316/6452678b/attachment-0002.bin>


More information about the devel mailing list