Browse Source

qcacmn: Check keyidx in wlan_crypto_getkey for validity

Check keyidx in wlan_crypto_getkey for validity.

Change-Id: I6bac8e8382e8850b0736ba6d4b9722672001d969
Ashok Ponnaiah 7 years ago
parent
commit
150a294b8a
1 changed files with 7 additions and 0 deletions
  1. 7 0
      umac/cmn_services/crypto/src/wlan_crypto_global_api.c

+ 7 - 0
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -542,6 +542,13 @@ QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev,
 	struct wlan_objmgr_psoc *psoc;
 	uint8_t macaddr[WLAN_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
+	if ((req_key->keyix != WLAN_CRYPTO_KEYIX_NONE) &&
+		(req_key->keyix >= WLAN_CRYPTO_MAXKEYIDX)) {
+		qdf_print("%s[%d] invalid keyix %d\n", __func__, __LINE__,
+							req_key->keyix);
+		return QDF_STATUS_E_INVAL;
+	}
+
 	wlan_vdev_obj_lock(vdev);
 	qdf_mem_copy(macaddr, wlan_vdev_mlme_get_macaddr(vdev), WLAN_ALEN);
 	psoc = wlan_vdev_get_psoc(vdev);