From 3b16cc5383c27b77b55059e2131e1b26dec7690c Mon Sep 17 00:00:00 2001 From: Victor Date: Sat, 17 Aug 2024 20:58:57 +0100 Subject: [PATCH] Fix one-off pattern mismatch --- objfile/patterns.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objfile/patterns.go b/objfile/patterns.go index de94199..281653e 100644 --- a/objfile/patterns.go +++ b/objfile/patterns.go @@ -288,12 +288,12 @@ func FindRegex(data []byte, regexInfo *RegexAndNeedle) [][]int { data_end := needleMatch + regexInfo.len - regexInfo.needleOffset if data_start >= data_len { continue - } else if data_start <= 0 { + } + if data_start < 0 { data_start = 0 } - - if data_end >= data_len { - data_end = data_len - 1 + if data_end > data_len { + data_end = data_len } // don't repeat previously scanned chunks