From 9dd7f4f903b750e41289ae36dd8626eb7956cf6a Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 25 May 2023 15:45:17 +0300 Subject: [PATCH] Fixed the code end boundary check --- ir_patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ir_patch.c b/ir_patch.c index 51ee3e4..39e08eb 100644 --- a/ir_patch.c +++ b/ir_patch.c @@ -151,7 +151,7 @@ static int ir_patch_code(const void *code, size_t size, const void *from_addr, c uint8_t *p, *end; p = (uint8_t*)code; - end = p + size - 5; + end = p + size - 4; while (p < end) { if ((*(unaligned_uint16_t*)p & 0xf0ff) == 0x800f && p + *(unaligned_int32_t*)(p+2) == (uint8_t*)from_addr - 6) { *(unaligned_int32_t*)(p+2) = ((uint8_t*)to_addr - (p + 6));