PMKSA: Guard against NULL KCK for memcpy()
If the kck_len is 0 then the pointer may be NULL. If that happens UBSAN complains about the NULL pointer as memcpy() has the arguments declared to never be NULL even if the copied number of bytes were zero. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
This commit is contained in:
parent
7bcede06e0
commit
ac15b79fe5
1 changed files with 2 additions and 1 deletions
|
@ -253,7 +253,8 @@ pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
|
|||
return NULL;
|
||||
os_memcpy(entry->pmk, pmk, pmk_len);
|
||||
entry->pmk_len = pmk_len;
|
||||
os_memcpy(entry->kck, kck, kck_len);
|
||||
if (kck_len > 0)
|
||||
os_memcpy(entry->kck, kck, kck_len);
|
||||
entry->kck_len = kck_len;
|
||||
if (pmkid)
|
||||
os_memcpy(entry->pmkid, pmkid, PMKID_LEN);
|
||||
|
|
Loading…
Reference in a new issue