From 5d08aee9af31d2f2c5405d7c66d03466ff56c74f Mon Sep 17 00:00:00 2001 From: Riccardo Schirone Date: Thu, 18 Feb 2016 13:52:31 +0100 Subject: [PATCH] bin/demangle: fix possible SEGV when dereferencing binfile --- libr/bin/demangle.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libr/bin/demangle.c b/libr/bin/demangle.c index 8ae590d934..f2f21ab1c4 100644 --- a/libr/bin/demangle.c +++ b/libr/bin/demangle.c @@ -345,8 +345,10 @@ R_API int r_bin_lang_type(RBinFile *binfile, const char *def, const char *sym) { R_API char *r_bin_demangle (RBinFile *binfile, const char *def, const char *str) { int type = -1; - RBin *bin = binfile->rbin; + RBin *bin; + if (!binfile) return NULL; + bin = binfile->rbin; if (!strncmp (str, "sym.", 4)) str += 4; if (!strncmp (str, "imp.", 4))