Bläddra i källkod

qcacld-3.0: fix buffer overflow in linkspeed ioctl

qcacld-2.0 to qcacld-3.0 propagation.

In linkspeed ioctl handler, mac address array is allocated a
size of MAC_ADDRESS_STR_LEN, which is 18 bytes taking account of null
terminator '\0'. But in code, a null terminator is being manually added
at index MAC_ADDRESS_STR_LEN. This would overflow the buffer and hence
null terminator should be added at MAC_ADDRESS_STR_LEN -1.

Change-Id: I16c2d0f787dfa339780db7d888aff37355c32322
CRs-fixed: 1000861
(cherry picked from commit 1ebc752f4b5c0a32f3b063ffe89c16fa0e2d81a0)
Manjeet Singh 8 år sedan
förälder
incheckning
75c2f97be4
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      core/hdd/src/wlan_hdd_hostapd.c

+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -5630,7 +5630,7 @@ int __iw_get_softap_linkspeed(struct net_device *dev,
 			hdd_notice("failed to copy data to user buffer");
 			return -EFAULT;
 		}
-		pmacAddress[MAC_ADDRESS_STR_LEN] = '\0';
+		pmacAddress[MAC_ADDRESS_STR_LEN - 1] = '\0';
 
 		if (!mac_pton(pmacAddress, macAddress.bytes)) {
 			hdd_err("String to Hex conversion Failed");