mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-27 10:28:22 +08:00
Fix findPattern logic when pattern is at the end of the data
references #404
This commit is contained in:
parent
3441255566
commit
0030ea9481
@ -461,7 +461,7 @@ INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSi
|
|||||||
if (patternSize == 0 || dataSize == 0 || dataOff >= dataSize || dataSize - dataOff < patternSize)
|
if (patternSize == 0 || dataSize == 0 || dataOff >= dataSize || dataSize - dataOff < patternSize)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
while (dataOff + patternSize < dataSize) {
|
while (dataOff + patternSize <= dataSize) {
|
||||||
bool matches = true;
|
bool matches = true;
|
||||||
for (UINTN i = 0; i < patternSize; i++) {
|
for (UINTN i = 0; i < patternSize; i++) {
|
||||||
if ((data[dataOff + i] & patternMask[i]) != pattern[i]) {
|
if ((data[dataOff + i] & patternMask[i]) != pattern[i]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user