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: ec5c39a557 ("AP: Allow identifying which passphrase station used with wpa_psk_file")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-02-18 18:24:52 +02:00 committed by Jouni Malinen
parent 5a3a131993
commit 2fae58fdc1
1 changed files with 2 additions and 0 deletions

View File

@ -303,6 +303,8 @@ static int hostapd_config_read_wpa_psk(const char *fname,
break; break;
context2 = NULL; context2 = NULL;
name = str_token(token, "=", &context2); name = str_token(token, "=", &context2);
if (!name)
break;
value = str_token(token, "", &context2); value = str_token(token, "", &context2);
if (!value) if (!value)
value = ""; value = "";