WPS: Fixed hostapd to use allocated buffers for device attributes

Previous version did not handle re-configuration correctly since WPS
context data was pointing to old (now freed) strings.
This commit is contained in:
Jouni Malinen 2008-11-29 21:12:12 +02:00
parent 23f53f2a81
commit 43fb17940f

View file

@ -388,11 +388,11 @@ int hostapd_init_wps(struct hostapd_data *hapd,
os_memcpy(wps->ssid, hapd->conf->ssid.ssid, wps->ssid_len);
wps->ap = 1;
os_memcpy(wps->dev.mac_addr, hapd->own_addr, ETH_ALEN);
wps->dev.device_name = hapd->conf->device_name;
wps->dev.manufacturer = hapd->conf->manufacturer;
wps->dev.model_name = hapd->conf->model_name;
wps->dev.model_number = hapd->conf->model_number;
wps->dev.serial_number = hapd->conf->serial_number;
wps->dev.device_name = os_strdup(hapd->conf->device_name);
wps->dev.manufacturer = os_strdup(hapd->conf->manufacturer);
wps->dev.model_name = os_strdup(hapd->conf->model_name);
wps->dev.model_number = os_strdup(hapd->conf->model_number);
wps->dev.serial_number = os_strdup(hapd->conf->serial_number);
if (hapd->conf->config_methods) {
char *m = hapd->conf->config_methods;
if (os_strstr(m, "label"))
@ -532,6 +532,7 @@ void hostapd_deinit_wps(struct hostapd_data *hapd)
return;
wps_registrar_deinit(hapd->wps->registrar);
os_free(hapd->wps->network_key);
wps_device_data_free(&hapd->wps->dev);
os_free(hapd->wps);
hapd->wps = NULL;
hostapd_wps_clear_ies(hapd);