[PATCH 1/2] wpa_supplicant: fix wrong size memory allocation

Ilan Peer ilan.peer at intel.com
Tue Jan 28 02:32:34 EST 2014


From: Eytan Lifshitz <eytan.lifshitz at intel.com>

Fix memory allocation in wpa_scan_clone_params(), where the
allocation request used the size of a pointer rather than the
size of the structure.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 wpa_supplicant/scan.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 30da097..18d243e 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1765,12 +1765,13 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src)
 	}
 
 	if (src->filter_ssids) {
-		params->filter_ssids = os_malloc(sizeof(params->filter_ssids) *
+		params->filter_ssids = os_malloc(sizeof(*params->filter_ssids) *
 						 src->num_filter_ssids);
 		if (params->filter_ssids == NULL)
 			goto failed;
 		os_memcpy(params->filter_ssids, src->filter_ssids,
-			  sizeof(params->filter_ssids) * src->num_filter_ssids);
+			  sizeof(*params->filter_ssids) *
+			  src->num_filter_ssids);
 		params->num_filter_ssids = src->num_filter_ssids;
 	}
 
-- 
1.7.10.4



More information about the HostAP mailing list