From 526f7aafe70a6de49f1c5d74f54fe94041141d3d Mon Sep 17 00:00:00 2001 From: WasserEsser Date: Thu, 30 Apr 2026 12:53:22 +0200 Subject: [PATCH] Add warning for multiple pattern matches --- patch.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/patch.sh b/patch.sh index 1e47229..c1213ed 100644 --- a/patch.sh +++ b/patch.sh @@ -60,6 +60,13 @@ hexdump -ve '1/1 "%.2x"' "$BINARY_FILE" > "$TEMP_FILE" echo "Searching for rsa.VerifyPKCS1v15 call inside LicenseValidatorImpl.ValidateLicense()" +MATCH_COUNT=$(grep -Eo -b "$SEARCH_PATTERN" "$TEMP_FILE" | wc -l) +if [ "$MATCH_COUNT" -gt 1 ]; then + echo "Warning: Found $MATCH_COUNT matches for the pattern. Using the first match." + echo "If patching fails or produces unexpected results, please report this at:" + echo " https://github.com//issues" +fi + FOUND_OFFSET=$(grep -Eo -b "$SEARCH_PATTERN" "$TEMP_FILE" | awk -F: '{print $1}' | head -n 1) if [ -z "$FOUND_OFFSET" ]; then