From d4ce40b516ffd70cf2e9e36832d8de139117d522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergi=20=C3=80lvarez=20i=20Capilla?= Date: Thu, 24 Mar 2022 10:11:29 +0100 Subject: [PATCH] Fix oobread in symbols header parsing ##bin --- libr/bin/p/bin_symbols.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libr/bin/p/bin_symbols.c b/libr/bin/p/bin_symbols.c index 2036dc092b6b6..779e36940ff1d 100644 --- a/libr/bin/p/bin_symbols.c +++ b/libr/bin/p/bin_symbols.c @@ -181,7 +181,7 @@ static RBinSymbol *bin_symbol_from_symbol(RCoreSymCacheElement *element, RCoreSy static RCoreSymCacheElement *parseDragons(RBinFile *bf, RBuffer *buf, int off, int bits, R_OWN char *file_name) { D eprintf ("Dragons at 0x%x\n", off); - ut64 size = r_buf_size (buf); + st64 size = r_buf_size (buf); if (off >= size) { return NULL; } @@ -189,6 +189,9 @@ static RCoreSymCacheElement *parseDragons(RBinFile *bf, RBuffer *buf, int off, i if (!size) { return NULL; } + if (size < 32) { + return NULL; + } ut8 *b = malloc (size); if (!b) { return NULL;