]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow WPS device strings to be unconfigured
authorJouni Malinen <j@w1.fi>
Thu, 22 Jan 2009 19:26:14 +0000 (21:26 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 22 Jan 2009 19:26:14 +0000 (21:26 +0200)
Previous version was causing a NULL pointer dereference if a required
string was not set in configuration. It is better to make these
optional.

hostapd/wps_hostapd.c

index a1560c981545fd92b19c239e5d6ef7b29308926e..902682c9d46ba54542b941f7a8c68848a5171030 100644 (file)
@@ -421,11 +421,16 @@ 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 = 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);
+       wps->dev.device_name = hapd->conf->device_name ?
+               os_strdup(hapd->conf->device_name) : NULL;
+       wps->dev.manufacturer = hapd->conf->manufacturer ?
+               os_strdup(hapd->conf->manufacturer) : NULL;
+       wps->dev.model_name = hapd->conf->model_name ?
+               os_strdup(hapd->conf->model_name) : NULL;
+       wps->dev.model_number = hapd->conf->model_number ?
+               os_strdup(hapd->conf->model_number) : NULL;
+       wps->dev.serial_number = hapd->conf->serial_number ?
+               os_strdup(hapd->conf->serial_number) : NULL;
        if (hapd->conf->config_methods) {
                char *m = hapd->conf->config_methods;
                if (os_strstr(m, "label"))