From feaa4e7f7399c51ee6f52deb84dc3f795b4035d6 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 31 Jan 2022 02:32:50 +0100 Subject: [PATCH] Fix null deref in xnu.kernelcache ##crash * Reported by @xshad3 via huntr.dev --- libr/bin/p/bin_xnu_kernelcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libr/bin/p/bin_xnu_kernelcache.c b/libr/bin/p/bin_xnu_kernelcache.c index 36b1c2db08..df5b1fe7d0 100644 --- a/libr/bin/p/bin_xnu_kernelcache.c +++ b/libr/bin/p/bin_xnu_kernelcache.c @@ -242,7 +242,9 @@ static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadadd beach: r_buf_free (fbuf); - obj->cache_buf = NULL; + if (obj) { + obj->cache_buf = NULL; + } MACH0_(mach0_free) (main_mach0); return false; }