Jelajahi Sumber

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 3 tahun lalu
induk
melakukan
2e6b1a67ed
1 mengubah file dengan 5 tambahan dan 3 penghapusan
  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);
+			}
 		}
 	}