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:
parent
30cf1aa376
commit
e256cbaba9
|
@ -570,8 +570,10 @@ 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);
|
||||||
memcpy(out_frame->key_data, extra_data, extra_len);
|
if (extra_len)
|
||||||
|
memcpy(out_frame->key_data, extra_data, extra_len);
|
||||||
|
|
||||||
return out_frame;
|
return out_frame;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue