From 2fae58fdc14219f1b86ed8bcea04f97ce6c943ca Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 18 Feb 2019 18:24:52 +0200 Subject: [PATCH] Fix wpa_psk_file parser error case handling str_token() can return NULL for the name if the remaining token contains only the delimiter. Fix this to avoid NULL pointer dereference with a corner case of an invalid value used in the configuration. Fixes: ec5c39a5574d ("AP: Allow identifying which passphrase station used with wpa_psk_file") Signed-off-by: Jouni Malinen --- src/ap/ap_config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 89ba399e9..11475b6e0 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -303,6 +303,8 @@ static int hostapd_config_read_wpa_psk(const char *fname, break; context2 = NULL; name = str_token(token, "=", &context2); + if (!name) + break; value = str_token(token, "", &context2); if (!value) value = "";