From d8c933f80ce72e38531ea6cf49c58bb9322b27cf Mon Sep 17 00:00:00 2001 From: David Crayford Date: Wed, 4 Mar 2020 15:57:52 +0800 Subject: [PATCH] Fix logic error Signed-off-by: David Crayford --- c/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/utils.c b/c/utils.c index 2d685840f..1b52ba603 100644 --- a/c/utils.c +++ b/c/utils.c @@ -150,7 +150,7 @@ int indexOfString(const char *sourceString, size_t sourceLength, const char *sea const char * currPos = sourceString + startPos; const char * endPos = sourceString + sourceLength - searchLength; char firstChar = searchString[0]; - while (currPos < endPos) { + while (currPos <= endPos) { size_t bytesRemaining = endPos - currPos + 1; currPos = memchr(currPos, firstChar, bytesRemaining); if (currPos == NULL) break;