* lib/str-two-way.h (two_way_long_needle): Avoid bug with long

periodic needle having false positive.  Affects memmem, strstr,
	strcasestr.
This commit is contained in:
Corinna Vinschen 2010-10-06 09:29:35 +00:00
parent 97ef23e0fc
commit c725984f70
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-10-06 Eric Blake <eblake@redhat.com>
* lib/str-two-way.h (two_way_long_needle): Avoid bug with long
periodic needle having false positive. Affects memmem, strstr,
strcasestr.
2010-09-21 Craig Howland <howland@LGSInnovations.com>
* libc/string/memcpy.c: Do not assign size_t parameter to int.

View File

@ -1,5 +1,5 @@
/* Byte-wise substring search, using the Two-Way algorithm.
* Copyright (C) 2008 Eric Blake
* Copyright (C) 2008, 2010 Eric Blake
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
@ -335,8 +335,8 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
a byte out of place, there can be no match until
after the mismatch. */
shift = needle_len - period;
memory = 0;
}
memory = 0;
j += shift;
continue;
}