fix strstr, memmem, strcasestr

Eric Blake eblake@redhat.com
Wed Oct 6 09:31:00 GMT 2010


My strstr() implementation originally posted for newlib was also copied 
to glibc, which means that newlib also suffers from this glibc bug:
http://sourceware.org/bugzilla/show_bug.cgi?id=12092

[Normally, newlib is immune from glibc bugs because newlib won't pull in 
LGPL code from glibc.  But remember that as the original author of this 
particular strstr() implementation, I exercised my right to dual-license 
my code; so although glibc's use of the implementation is LGPL, newlib's 
use is under a more-permissive license.]

Since it's a bug in my original implementation, and the fix is a single 
line swap, I'm pushing the fix as obvious (whether the algorithm is 
obvious is a different question).

2010-10-05  Eric Blake  <eblake@redhat.com>

	memmem, strstr, strcasestr: fix bug with long periodic needle
	* lib/str-two-way.h (two_way_long_needle): Avoid bug with long
	periodic needle having false positive.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newlib.patch47
URL: <http://sourceware.org/pipermail/newlib/attachments/20101006/3ab54031/attachment.ksh>


More information about the Newlib mailing list