[PATCH 7/7] WNM: Fix possible memory leak by free buf

Ilan Peer ilan.peer at intel.com
Sun Jan 18 20:44:39 EST 2015


From: Haim Dreyfuss <haim.dreyfuss at intel.com>

Buf is allocated and may not be freed.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss at intel.com>
---
 src/ap/wnm_ap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c
index 7e8fb5c..4c8bc10 100644
--- a/src/ap/wnm_ap.c
+++ b/src/ap/wnm_ap.c
@@ -564,8 +564,11 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
 	if (url) {
 		/* Session Information URL */
 		url_len = os_strlen(url);
-		if (url_len > 255)
+		if (url_len > 255) {
+			os_free(buf);
 			return -1;
+		}
+
 		*pos++ = url_len;
 		os_memcpy(pos, url, url_len);
 		pos += url_len;
-- 
1.8.3.2



More information about the HostAP mailing list