From a6a6c4c79f492ccfb845692448f32b3977d6089f Mon Sep 17 00:00:00 2001 From: Snaipe Date: Wed, 19 Aug 2015 17:48:41 -0700 Subject: [PATCH] Fixed crashes on invalid report hooks --- src/report.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/report.c b/src/report.c index 8f8bf39..64a6861 100644 --- a/src/report.c +++ b/src/report.c @@ -33,13 +33,15 @@ #include "config.h" #include "posix-compat.h" +static inline void nothing() {} + #define IMPL_CALL_REPORT_HOOKS(Kind) \ IMPL_SECTION_LIMITS(f_report_hook, HOOK_SECTION(Kind)); \ void call_report_hooks_##Kind(void *data) { \ for (f_report_hook *hook = GET_SECTION_START(HOOK_SECTION(Kind)); \ hook < (f_report_hook*) GET_SECTION_END(HOOK_SECTION(Kind)); \ ++hook) { \ - (*hook)(data); \ + (*hook ?: nothing)(data); \ } \ }