Bug in MIPS strncpy
Jeff Johnston
jjohnstn@redhat.com
Mon Jun 30 15:49:00 GMT 2008
Perry McFarlane wrote:
> I found a bug in the MIPS-optimized strncpy
> (newlib/libc/machine/mips/strncpy.c)
> There is an unrolled loop to read from the source string 4 bytes at a
> time, but this could read past the \0 and cause a SEGV.
>
> The MIPS-optimized strncpy was added as part of this patch:
> http://sourceware.org/ml/newlib/2001/msg00594.html
>
> I suppose that it could be fixed by only reading groups of 4 bytes that
> are word-alligned.
>
I have created a patch.
-- Jeff J.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: strncpy.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20080630/23719229/attachment.ksh>
More information about the Newlib
mailing list