]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix theoretical NULL dereference in debug printf
authorEytan Lifshitz <eytan.lifshitz@intel.com>
Mon, 10 Feb 2014 10:55:06 +0000 (12:55 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 13 Feb 2014 13:58:15 +0000 (15:58 +0200)
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 <eytan.lifshitz@intel.com>

hostapd/main.c

index db2a455824555b078eb49434fb1f1603b81c05a7..30269293c5a3984bbe9432d34815b5c6086a7d3d 100644 (file)
@@ -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 ? " " : "",