Browse Source

typo: compare len against null needle, not haystack

from Alf Schlichting
ok millert@
OPENBSD_5_4
ajacoutot 11 years ago
parent
commit
29e7601c1a
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lib/libc/string/memmem.c

+ 2
- 2
src/lib/libc/string/memmem.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: memmem.c,v 1.1 2013/05/13 10:37:02 ajacoutot Exp $ */
/* $OpenBSD: memmem.c,v 1.2 2013/05/15 12:45:59 ajacoutot Exp $ */
/*- /*-
* Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com> * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
* *
@ -42,7 +42,7 @@ memmem(const void *l, size_t l_len, const void *s, size_t s_len)
const char *cs = s; const char *cs = s;
/* a zero length needle should just return the haystack */ /* a zero length needle should just return the haystack */
if (l_len == 0)
if (s_len == 0)
return (void *)cl; return (void *)cl;
/* "s" must be smaller or equal to "l" */ /* "s" must be smaller or equal to "l" */


Loading…
Cancel
Save