* libc/memmem.cc (memmem): Fix bug when searching for empty string.

This commit is contained in:
Corinna Vinschen 2007-12-20 10:11:37 +00:00
parent 26b8429317
commit 39962e28d0
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2007-12-20 Eric Blake <ebb9@byu.net>
* libc/memmem.cc (memmem): Fix bug when searching for empty string.
2007-12-19 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Export wcpcpy, wcpncpy.

View File

@ -45,8 +45,8 @@ memmem (const void *l, size_t l_len,
const char *cs = (const char *)s;
/* we need something to compare */
if (l_len == 0 || s_len == 0)
return NULL;
if (s_len == 0)
return (void *) l;
/* "s" must be smaller or equal to "l" */
if (l_len < s_len)