From 1763def25f14d94eadb194d04acc64e3f0db0b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Mun=CC=83oz?= Date: Sat, 20 Dec 2014 14:30:08 +0100 Subject: [PATCH] fix #1878 --- libr/core/asm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libr/core/asm.c b/libr/core/asm.c index 9fa398d764..5a94b28046 100644 --- a/libr/core/asm.c +++ b/libr/core/asm.c @@ -351,6 +351,7 @@ static int is_hit_inrange(RCoreAsmHit *hit, ut64 start_range, ut64 end_range){ R_API RList *r_core_asm_bwdisassemble (RCore *core, ut64 addr, int n, int len) { RList *hits = r_core_asm_hit_list_new(); + int buflen = len; RCoreAsmHit dummy_value; RAsmOp op; ut8 *buf = (ut8 *)malloc (len); @@ -397,6 +398,18 @@ R_API RList *r_core_asm_bwdisassemble (RCore *core, ut64 addr, int n, int len) { } } if (hit_count >= n) break; + + if (idx == len-1) { + len += buflen; + if (!(buf = realloc (buf, len))) { + if (hits) { + r_list_purge (hits); + free (hits); + } + free (buf); + return NULL; + } + } } if (hit_count == n) {