From 0ff7d9b4e9566cf24bac5fc2eecadc2bd158a184 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 7 Feb 2009 19:34:44 +0000 Subject: [PATCH] Make sure the comparison is done with an unsigned char. --- lib/libc/string/memchr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/string/memchr.c b/lib/libc/string/memchr.c index 6d7c2fd94e7..d98d85317e5 100644 --- a/lib/libc/string/memchr.c +++ b/lib/libc/string/memchr.c @@ -45,7 +45,7 @@ memchr(const void *s, int c, size_t n) const unsigned char *p = s; do { - if (*p++ == c) + if (*p++ == (unsigned char)c) return ((void *)(p - 1)); } while (--n != 0); }