diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-10-06 09:29:35 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-10-06 09:29:35 +0000 |
commit | c725984f706d8eec636c9cab24ccd8af8280781e (patch) | |
tree | 54bd2ff9529c3073eed9ad80a9354e1225773e24 /newlib | |
parent | 97ef23e0fccbb4987bc0e5e94cfd046ca6215b0c (diff) | |
download | cygnal-c725984f706d8eec636c9cab24ccd8af8280781e.tar.gz cygnal-c725984f706d8eec636c9cab24ccd8af8280781e.tar.bz2 cygnal-c725984f706d8eec636c9cab24ccd8af8280781e.zip |
* lib/str-two-way.h (two_way_long_needle): Avoid bug with long
periodic needle having false positive. Affects memmem, strstr,
strcasestr.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 6 | ||||
-rw-r--r-- | newlib/libc/string/str-two-way.h | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 349598ea4..f1495f85a 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -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. diff --git a/newlib/libc/string/str-two-way.h b/newlib/libc/string/str-two-way.h index 72b60c39c..416f9d29f 100644 --- a/newlib/libc/string/str-two-way.h +++ b/newlib/libc/string/str-two-way.h @@ -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; } |