From 0030ea9481b1644ea6c00ba0050f35be6e75ad34 Mon Sep 17 00:00:00 2001 From: Vitaly Cheptsov <4348897+vit9696@users.noreply.github.com> Date: Wed, 9 Oct 2024 23:36:23 +0300 Subject: [PATCH] Fix findPattern logic when pattern is at the end of the data references #404 --- common/utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utility.cpp b/common/utility.cpp index 336b7c7..af80df4 100755 --- a/common/utility.cpp +++ b/common/utility.cpp @@ -461,7 +461,7 @@ INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSi if (patternSize == 0 || dataSize == 0 || dataOff >= dataSize || dataSize - dataOff < patternSize) return -1; - while (dataOff + patternSize < dataSize) { + while (dataOff + patternSize <= dataSize) { bool matches = true; for (UINTN i = 0; i < patternSize; i++) { if ((data[dataOff + i] & patternMask[i]) != pattern[i]) {