diff --git a/src/eap-mschapv2.c b/src/eap-mschapv2.c index 8b9c059e..bb164544 100644 --- a/src/eap-mschapv2.c +++ b/src/eap-mschapv2.c @@ -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); }