Browse Source

qcacmn: Fix out-of-bound read in T2LM IE parse API

In wlan_mlo_parse_t2lm_ie(), the code is present to check if the frame
length is less than the parsed IE length plus size of ie_header structure
(2 bytes). If the above condition is false then the subsequent code will
access the data of parsed IE length plus size of extn_ie_header structure
(3 bytes).

To fix the out-of-bound read, check if the frame length is less than
parsed IE length plus size of extn_ie_header structure.
Also, added the code to return success if frame length is same as parsed
IE length.

Change-Id: I07c32379ecd18d253a82876127c33b4d95196dd2
CRs-Fixed: 3704796
Shashikala Prabhu 1 year ago
parent
commit
20e6be3aa4
1 changed files with 10 additions and 2 deletions
  1. 10 2
      umac/mlo_mgr/src/wlan_mlo_t2lm.c

+ 10 - 2
umac/mlo_mgr/src/wlan_mlo_t2lm.c

@@ -224,8 +224,16 @@ QDF_STATUS wlan_mlo_parse_t2lm_ie(
 			return QDF_STATUS_E_NULL_VALUE;
 		}
 
-		if (frame_len < (ie_len_parsed + sizeof(struct ie_header))) {
-			t2lm_err("Frame length is lesser than parsed T2LM IE header length");
+		if (frame_len == ie_len_parsed) {
+			t2lm_debug("Received T2LM IEs are parsed successfully");
+			return QDF_STATUS_SUCCESS;
+		}
+
+		if (frame_len < (ie_len_parsed +
+				 sizeof(struct extn_ie_header))) {
+			t2lm_err("Frame length %d is lesser than parsed T2LM IE header length %zu",
+				 frame_len,
+				 ie_len_parsed + sizeof(struct extn_ie_header));
 			return QDF_STATUS_E_PROTO;
 		}