From 0d533a30cf645a1b6f97326e851cad1bdeaca35a Mon Sep 17 00:00:00 2001 From: Maxime Meignan Date: Thu, 27 Feb 2025 19:12:11 +0100 Subject: [PATCH] Fixed bound on memcpy loop in thumb,arm,aarch64 --- pwnlib/shellcraft/templates/aarch64/memcpy.asm | 2 +- pwnlib/shellcraft/templates/arm/memcpy.asm | 2 +- pwnlib/shellcraft/templates/thumb/memcpy.asm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pwnlib/shellcraft/templates/aarch64/memcpy.asm b/pwnlib/shellcraft/templates/aarch64/memcpy.asm index 8514ac6fd..468f0e339 100644 --- a/pwnlib/shellcraft/templates/aarch64/memcpy.asm +++ b/pwnlib/shellcraft/templates/aarch64/memcpy.asm @@ -16,4 +16,4 @@ ${memcpy_loop}: ldrb w3, [x1], #1 strb w3, [x0], #1 subs x2, x2, #1 - bge ${memcpy_loop} + bgt ${memcpy_loop} diff --git a/pwnlib/shellcraft/templates/arm/memcpy.asm b/pwnlib/shellcraft/templates/arm/memcpy.asm index 8c4b2d877..b6714c157 100644 --- a/pwnlib/shellcraft/templates/arm/memcpy.asm +++ b/pwnlib/shellcraft/templates/arm/memcpy.asm @@ -16,4 +16,4 @@ ${memcpy_loop}: ldrb r3, [r1], #1 strb r3, [r0], #1 subs r2, r2, #1 - bge ${memcpy_loop} + bgt ${memcpy_loop} diff --git a/pwnlib/shellcraft/templates/thumb/memcpy.asm b/pwnlib/shellcraft/templates/thumb/memcpy.asm index 250555c40..5f3ce2dc7 100644 --- a/pwnlib/shellcraft/templates/thumb/memcpy.asm +++ b/pwnlib/shellcraft/templates/thumb/memcpy.asm @@ -16,4 +16,4 @@ ${memcpy_loop}: ldrb r3, [r1], #1 strb r3, [r4], #1 subs r2, r2, #1 - bge ${memcpy_loop} + bgt ${memcpy_loop}