diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2013-05-15 12:46:00 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2013-05-15 12:46:00 +0000 |
commit | c2645e1d4d4d66d996881da18620d1a117e18c62 (patch) | |
tree | b472ba691eb426ca64d750a14f1a6c52be379300 /lib/libc/string | |
parent | fab41fc0fb718bce81831f4258462af2abc90062 (diff) |
typo: compare len against null needle, not haystack
from Alf Schlichting
ok millert@
Diffstat (limited to 'lib/libc/string')
-rw-r--r-- | lib/libc/string/memmem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/string/memmem.c b/lib/libc/string/memmem.c index b54931a9cfe..f94285abcfb 100644 --- a/lib/libc/string/memmem.c +++ b/lib/libc/string/memmem.c @@ -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> * @@ -42,7 +42,7 @@ memmem(const void *l, size_t l_len, const void *s, size_t s_len) const char *cs = s; /* a zero length needle should just return the haystack */ - if (l_len == 0) + if (s_len == 0) return (void *)cl; /* "s" must be smaller or equal to "l" */ |