From 3b63edb7acd4505d513c05c239c6255159ac22e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Felipe=20Melchor?= Date: Wed, 3 Jun 2015 22:53:21 +0200 Subject: [PATCH] Fix #2684 --- libr/bin/dwarf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libr/bin/dwarf.c b/libr/bin/dwarf.c index 4f2485747e363..0973de2a6da2c 100644 --- a/libr/bin/dwarf.c +++ b/libr/bin/dwarf.c @@ -462,7 +462,8 @@ static const ut8* r_bin_dwarf_parse_ext_opcode(const RBin *a, const ut8 *obuf, buf += (strlen (filename) + 1); ut64 dir_idx; - buf = r_uleb128 (buf, ST32_MAX, &dir_idx); + if (buf+1 < buf_end) + buf = r_uleb128 (buf, ST32_MAX, &dir_idx); break; case DW_LNE_set_discriminator: buf = r_uleb128(buf, ST32_MAX, &addr); @@ -1522,7 +1523,7 @@ R_API RList *r_bin_dwarf_parse_line(RBin *a, int mode) { if (len<1) { return NULL; } - buf = calloc (1, len); + buf = calloc (1, len+1); ret = r_buf_read_at (binfile->buf, section->paddr, buf, len); if (!ret) { free (buf);