Parcourir la source

TDLS: Fix TPK M1 error case (CID 68214)

Commit 342bce63cdb375bc64ce1cbcdb9e6f48acdea1e3 introduced a possibility
of a NULL pointer dereference on the error path if a new peer entry
fails to get added (i.e., memory allocation failure). Fix that by
skipping the wpa_tdls_peer_free() call if necessary.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen il y a 11 ans
Parent
commit
7efc7f66b1
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      src/rsn_supp/tdls.c

+ 2 - 1
src/rsn_supp/tdls.c

@@ -1920,7 +1920,8 @@ skip_rsn_check:
 error:
 	wpa_tdls_send_error(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE, dtoken,
 			    status);
-	wpa_tdls_peer_free(sm, peer);
+	if (peer)
+		wpa_tdls_peer_free(sm, peer);
 	return -1;
 }