From 864ac249982d658bad44d6e6a48cdd40e9c03537 Mon Sep 17 00:00:00 2001 From: rgimad Date: Fri, 18 Apr 2025 17:21:04 +0300 Subject: [PATCH] fixed segfault. (wrongly translated loop instruction from asm) --- kpack_c.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kpack_c.c b/kpack_c.c index e0a296f..2d7f2d8 100644 --- a/kpack_c.c +++ b/kpack_c.c @@ -60,7 +60,7 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c do { //printf("infile_ptr = %p, count = %u\n", infile_ptr, count); unsigned al = *(infile_ptr++); - al -= 0x0E8; + al -= 0x0E8; // relative call opcode if (al > 1) { continue; } @@ -82,8 +82,7 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c memcpy(buf_ptr, &infile_ptr, sizeof(buf_ptr)); buf_ptr += sizeof(buf_ptr); } - - } while(count > 0); + } while(--count > 0); unsigned idx = 0; while (idx < 256 && ct1[idx] != 0) {