]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix wpa_psk_file parser error case handling
authorJouni Malinen <jouni@codeaurora.org>
Mon, 18 Feb 2019 16:24:52 +0000 (18:24 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 18 Feb 2019 16:41:32 +0000 (18:41 +0200)
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 <jouni@codeaurora.org>
src/ap/ap_config.c

index 89ba399e9be2d4fc7785b2f1d8df51cc87ad08b4..11475b6e0d1410440d7d4afe1b381d6acfa311aa 100644 (file)
@@ -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 = "";