3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-27 03:19:24 +01:00

eapol: Don't memcpy if no extra data

As reported by the sanitizer:

src/eapol.c:574:2: runtime error: null pointer passed as argument 2,
	which is declared to never be null
This commit is contained in:
Denis Kenzior 2019-01-11 17:10:47 -06:00
parent 30cf1aa376
commit e256cbaba9

View File

@ -570,7 +570,9 @@ static struct eapol_key *eapol_create_common(
out_frame->key_length = 0; out_frame->key_length = 0;
out_frame->key_replay_counter = L_CPU_TO_BE64(key_replay_counter); out_frame->key_replay_counter = L_CPU_TO_BE64(key_replay_counter);
memcpy(out_frame->key_nonce, snonce, sizeof(out_frame->key_nonce)); memcpy(out_frame->key_nonce, snonce, sizeof(out_frame->key_nonce));
out_frame->key_data_len = L_CPU_TO_BE16(extra_len); out_frame->key_data_len = L_CPU_TO_BE16(extra_len);
if (extra_len)
memcpy(out_frame->key_data, extra_data, extra_len); memcpy(out_frame->key_data, extra_data, extra_len);
return out_frame; return out_frame;