From: Ben Pfaff Date: Tue, 13 Dec 2005 06:47:18 +0000 (+0000) Subject: Fix fencepost error in strstr(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8e7532e684e4ea92a06d4eaf0d9ab714e4c2ad2;p=pintos-anon Fix fencepost error in strstr(). Thanks to Bryan Branstetter for bug and fix. --- diff --git a/src/lib/string.c b/src/lib/string.c index 01e4ecb..d223c89 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -190,7 +190,7 @@ strstr (const char *haystack, const char *needle) { size_t i; - for (i = 0; i < haystack_len - needle_len; i++) + for (i = 0; i <= haystack_len - needle_len; i++) if (!memcmp (haystack + i, needle, needle_len)) return (char *) haystack + i; }