Possible bug in fortified stpncpy

Zack Weinberg zackw@panix.com
Sun Aug 9 14:19:00 GMT 2015


On 08/08/2015 11:32 PM, Mike Frysinger wrote:
> On 08 Aug 2015 17:06, Zack Weinberg wrote:
>> [stpncpy] should call the runtime-checking function
>> if __n is not constant, or if __n is known to be LARGER
>> than the size of the destination.  Ne?
> 
> agreed.  feel like sending a patch ? :)

Patch is attached.  In addition to the actual two-character bugfix, I
enhanced debug/tst-chk1.c to catch this and similar bugs.  I also filed
https://sourceware.org/bugzilla/show_bug.cgi?id=18795 and I suspect this
needs to get backported as widely as possible.

(Is there a way to run just one subdirectory's tests?  This was tedious
to develop, what with string.h getting used basically everywhere.)

zw

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Correct-backwards-conditional-in-stpncpy-fortificati.patch
Type: text/x-patch
Size: 9582 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150809/cce60174/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150809/cce60174/attachment.sig>


More information about the Libc-alpha mailing list