Quellcode durchsuchen

qcacld-3.0: Add pointer check before dereferencing

Make sure the parsed association request array is valid at the
association ID index, before dereferencing it. This will prevent NULL
pointer deref. There is already a check for the beginning of the parsed
assoc req array, but it is not checking at the assoc ID index.

Change-Id: Icac3b2a4a0646dec4c64a2224e3271b0842a8194
CRs-Fixed: 3147273
Lincoln Tran vor 3 Jahren
Ursprung
Commit
2e6b1a67ed
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      core/mac/src/pe/lim/lim_assoc_utils.c

+ 5 - 3
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -2558,9 +2558,11 @@ lim_add_sta(struct mac_context *mac_ctx,
 			assoc_req =
 			(tpSirAssocReq) session_entry->parsedAssocReq[aid];
 
-			add_sta_params->wpa_rsn = assoc_req->rsnPresent;
-			add_sta_params->wpa_rsn |=
-				(assoc_req->wpaPresent << 1);
+			if (assoc_req) {
+				add_sta_params->wpa_rsn = assoc_req->rsnPresent;
+				add_sta_params->wpa_rsn |=
+					(assoc_req->wpaPresent << 1);
+			}
 		}
 	}