Преглед на файлове

qcacld-3.0: Validate "set passpoint list" network count

This is a qcacld-2.0 to qcacld-3.0 propagation.

Currently when processing the "set passpoint list" vendor command the
"number of networks" parameter is not limit checked. This value is
subsequently used to calculate the size of a buffer. Add a limit check
to ensure that an appropriately sized buffer is always allocated.

Change-Id: Ibc2346b8a62898fc47e2d1efe457c57c08b0cada
CRs-Fixed: 1091940
Jeff Johnson преди 8 години
родител
ревизия
96f93a399d
променени са 2 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 6 0
      core/hdd/src/wlan_hdd_ext_scan.c
  2. 1 0
      core/mac/inc/sir_api.h

+ 6 - 0
core/hdd/src/wlan_hdd_ext_scan.c

@@ -4211,6 +4211,12 @@ static int __wlan_hdd_cfg80211_set_passpoint_list(struct wiphy *wiphy,
 	}
 	num_networks = nla_get_u32(
 		tb[QCA_WLAN_VENDOR_ATTR_PNO_PASSPOINT_LIST_PARAM_NUM]);
+	if (num_networks > SIR_PASSPOINT_LIST_MAX_NETWORKS) {
+		hdd_err("num networks %u exceeds max %u",
+			num_networks, SIR_PASSPOINT_LIST_MAX_NETWORKS);
+		return -EINVAL;
+	}
+
 	hdd_notice("num networks %u", num_networks);
 
 	req_msg = qdf_mem_malloc(sizeof(*req_msg) +

+ 1 - 0
core/mac/inc/sir_api.h

@@ -4749,6 +4749,7 @@ struct wifi_epno_params {
 	struct wifi_epno_network networks[];
 };
 
+#define SIR_PASSPOINT_LIST_MAX_NETWORKS 8
 #define SIR_PASSPOINT_REALM_LEN 256
 #define SIR_PASSPOINT_ROAMING_CONSORTIUM_ID_NUM 16
 #define SIR_PASSPOINT_PLMN_LEN 3