From 1e2ffc608bb4b5085cd2dc17ba51d23c790469aa Mon Sep 17 00:00:00 2001 From: Eytan Lifshitz Date: Mon, 10 Feb 2014 12:55:06 +0200 Subject: [PATCH] Fix theoretical NULL dereference in debug printf In hostapd_logger_cb(), module_str is checked for NULL (on a path that does not get executed in practice), and then possibly dereferenced in snprintf() anyway. Signed-hostap: Eytan Lifshitz --- hostapd/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hostapd/main.c b/hostapd/main.c index db2a45582..30269293c 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -92,7 +92,8 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, if (hapd && hapd->conf && addr) os_snprintf(format, maxlen, "%s: STA " MACSTR "%s%s: %s", hapd->conf->iface, MAC2STR(addr), - module_str ? " " : "", module_str, txt); + module_str ? " " : "", module_str ? module_str : "", + txt); else if (hapd && hapd->conf) os_snprintf(format, maxlen, "%s:%s%s %s", hapd->conf->iface, module_str ? " " : "",