Skip to content

Commit 2174374

Browse files
author
Arto Kinnunen
authored
Fix error found by coverity (ARMmbed#2389)
Fix error found by coverity CID 682646: Dereference null return value
1 parent 843254a commit 2174374

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/6LoWPAN/ws/ws_pae_supp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ int8_t ws_pae_supp_nw_key_valid(protocol_interface_info_entry_t *interface_ptr,
286286

287287
/* If border router EUI-64 received on bootstrap complete does not match to
288288
EUI-64 stored with keys, delete keys */
289-
if (memcmp(ptk_eui_64, pae_supp->comp_br_eui_64, 8) != 0) {
290-
tr_warn("Delete keys: PTK EUI-64 %s does not match to BR EUI-64 %s", tr_array(ptk_eui_64, 8), tr_array(pae_supp->comp_br_eui_64, 8));
289+
if (!ptk_eui_64 || memcmp(ptk_eui_64, pae_supp->comp_br_eui_64, 8) != 0) {
290+
tr_warn("Delete keys: PTK EUI-64 %s does not match to BR EUI-64 %s",
291+
ptk_eui_64 ? tr_array(ptk_eui_64, 8) : "", tr_array(pae_supp->comp_br_eui_64, 8));
291292
sec_prot_keys_pmk_delete(&pae_supp->entry.sec_keys);
292293
sec_prot_keys_ptk_delete(&pae_supp->entry.sec_keys);
293294
sec_prot_keys_ptk_eui_64_delete(&pae_supp->entry.sec_keys);

0 commit comments

Comments
 (0)