diff options
author | 2008-08-23 05:34:36 +0000 | |
---|---|---|
committer | 2008-08-23 05:34:36 +0000 | |
commit | c312416204eb5f280bcc89f4849b6dd30d842e7f (patch) | |
tree | c065dcb1dc8338f10d92cbeec9feaae1230ffd1d /lib/libc/string/wcschr.c | |
parent | make sure we always map and unmap multiples of MALLOC_PAGESIZE; (diff) | |
download | wireguard-openbsd-c312416204eb5f280bcc89f4849b6dd30d842e7f.tar.xz wireguard-openbsd-c312416204eb5f280bcc89f4849b6dd30d842e7f.zip |
unbreak wcschr(string, L'\0') which was incorrectly returning NULL
rather than a pointer to the terminating nul; ok deraadt@
Diffstat (limited to 'lib/libc/string/wcschr.c')
-rw-r--r-- | lib/libc/string/wcschr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/string/wcschr.c b/lib/libc/string/wcschr.c index c06127e087e..b84a2d32e3a 100644 --- a/lib/libc/string/wcschr.c +++ b/lib/libc/string/wcschr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wcschr.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: wcschr.c,v 1.4 2008/08/23 05:34:36 djm Exp $ */ /* $NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ /*- @@ -37,12 +37,14 @@ wcschr(const wchar_t *s, wchar_t c) const wchar_t *p; p = s; - while (*p) { + for (;;) { if (*p == c) { /* LINTED interface specification */ return (wchar_t *)p; } + if (!*p) + return NULL; p++; } - return NULL; + /* NOTREACHED */ } |