* libc/memmem.cc (memmem): Fix bug when searching for empty string.
This commit is contained in:
parent
26b8429317
commit
39962e28d0
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue