Bläddra i källkod

qcacld-3.0: Fix user space accesses

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

Don't access user space memory directly in
drv_cmd_get_ibss_peer_info_all.

Change-Id: I36a706e2e91d1ed2a43897ac2eef9d81b2de7335
CRs-Fixed: 2022841
Srinivas Girigowda 8 år sedan
förälder
incheckning
051a9b4885
1 ändrade filer med 4 tillägg och 3 borttagningar
  1. 4 3
      core/hdd/src/wlan_hdd_ioctl.c

+ 4 - 3
core/hdd/src/wlan_hdd_ioctl.c

@@ -5071,8 +5071,9 @@ static int drv_cmd_get_ibss_peer_info_all(hdd_adapter_t *adapter,
 			goto exit;
 		}
 
-		priv_data->buf[numOfBytestoPrint] = '\0';
-		hdd_debug("%s", priv_data->buf);
+		/* This overwrites the last space, which we already copied */
+		extra[numOfBytestoPrint - 1] = '\0';
+		hdd_debug("%s", extra);
 
 		if (length > numOfBytestoPrint) {
 			if (copy_to_user
@@ -5083,7 +5084,7 @@ static int drv_cmd_get_ibss_peer_info_all(hdd_adapter_t *adapter,
 				ret = -EFAULT;
 				goto exit;
 			}
-			hdd_debug("%s", &priv_data->buf[numOfBytestoPrint]);
+			hdd_debug("%s", &extra[numOfBytestoPrint]);
 		}
 
 		/* Free temporary buffer */