From 18d1d064bf599a255d55f09fca3104776fc34a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergi=20=C3=80lvarez=20i=20Capilla?= Date: Fri, 8 Apr 2022 19:49:21 +0200 Subject: [PATCH] Fix null deref in the ne parser ##crash * Reported by @hmsec via huntr.dev * Reproducer: nepoc00 * BountyID: bfeb8fb8-644d-4587-80d4-cb704c404013 --- libr/bin/format/ne/ne.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libr/bin/format/ne/ne.c b/libr/bin/format/ne/ne.c index f080e937fc9bb..ee2df871ac87b 100644 --- a/libr/bin/format/ne/ne.c +++ b/libr/bin/format/ne/ne.c @@ -115,7 +115,7 @@ RList *r_bin_ne_get_symbols(r_bin_ne_obj_t *bin) { } RList *entries = r_bin_ne_get_entrypoints (bin); bool resident = true, first = true; - while (true) { + while (entries) { ut8 sz = r_buf_read8_at (bin->buf, off); if (!sz) { first = true; @@ -352,6 +352,9 @@ RList *r_bin_ne_get_imports(r_bin_ne_obj_t *bin) { } RList *r_bin_ne_get_entrypoints(r_bin_ne_obj_t *bin) { + if (!bin->entry_table) { + return NULL; + } RList *entries = r_list_newf (free); if (!entries) { return NULL;