eap-mschapv2: Check hexstring parses in load_settings

load_settings is assumed to do minimum error checking to avoid crashing
on invalid input.
This commit is contained in:
Andrew Zaborowski 2019-03-21 03:54:15 +01:00 committed by Denis Kenzior
parent 94043d6bcb
commit 970ce050fe
1 changed files with 4 additions and 1 deletions

View File

@ -539,7 +539,10 @@ static bool eap_mschapv2_load_settings(struct eap_state *eap,
goto error;
tmp = l_util_from_hexstring(hash_str, &len);
memcpy(state->password_hash, tmp, 16);
if (!tmp)
goto error;
memcpy(state->password_hash, tmp, len);
explicit_bzero(tmp, len);
l_free(tmp);
}