Skip to content

Commit

Permalink
Fix findPattern logic when pattern is at the end of the data
Browse files Browse the repository at this point in the history
references #404
  • Loading branch information
vit9696 authored Oct 9, 2024
1 parent 3441255 commit 0030ea9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit 0030ea9

Please sign in to comment.