From a8e7532e684e4ea92a06d4eaf0d9ab714e4c2ad2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 13 Dec 2005 06:47:18 +0000 Subject: [PATCH] Fix fencepost error in strstr(). Thanks to Bryan Branstetter for bug and fix. --- src/lib/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.30.2