Browse Source

P2P: Fix a potential memory leak in a P2P+NFC corner case

Avoid memory leak due to previous allocation for ssid->ssid. It does not
look like this is hit in normal cases, but at might be possible for the
SSID to get set if the peer is present in previous scan results and WPS
code ends up copying the SSID from there.

Signed-off-by: Purushottam Kushwaha <p.kushwaha@samsung.com>
Purushottam Kushwaha 10 years ago
parent
commit
eda9d84dfd
1 changed files with 1 additions and 0 deletions
  1. 1 0
      wpa_supplicant/wps_supplicant.c

+ 1 - 0
wpa_supplicant/wps_supplicant.c

@@ -1187,6 +1187,7 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
 	}
 #ifdef CONFIG_P2P
 	if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
+		os_free(ssid->ssid);
 		ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
 		if (ssid->ssid) {
 			ssid->ssid_len = wpa_s->go_params->ssid_len;