WPS: Update couple of missed Primary Device Type uses
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 26 Nov 2009 09:54:37 +0000 (11:54 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Nov 2009 09:54:37 +0000 (11:54 +0200)
src/wps/wps.c
wpa_supplicant/wps_supplicant.c

index 6b0c6c7..cc5baab 100644 (file)
@@ -419,11 +419,12 @@ int wps_attr_text(struct wpabuf *data, char *buf, char *end)
        }
 
        if (attr.primary_dev_type) {
+               char devtype[WPS_DEV_TYPE_BUFSIZE];
                ret = os_snprintf(pos, end - pos,
-                                 "wps_primary_device_type=%u-%08x-%u\n",
-                                 WPA_GET_BE16(attr.primary_dev_type),
-                                 WPA_GET_BE32(&attr.primary_dev_type[2]),
-                                 WPA_GET_BE16(&attr.primary_dev_type[6]));
+                                 "wps_primary_device_type=%s\n",
+                                 wps_dev_type_bin2str(attr.primary_dev_type,
+                                                      devtype,
+                                                      sizeof(devtype)));
                if (ret < 0 || ret >= end - pos)
                        return pos - buf;
                pos += ret;
index f5a96b1..938ad89 100644 (file)
@@ -414,14 +414,12 @@ static void wpa_supplicant_wps_event_er_ap_add(struct wpa_supplicant *wpa_s,
                                               struct wps_event_er_ap *ap)
 {
        char uuid_str[100];
-       char dev_type[20];
+       char dev_type[WPS_DEV_TYPE_BUFSIZE];
 
        uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str));
        if (ap->pri_dev_type)
-               os_snprintf(dev_type, sizeof(dev_type), "%u-%08X-%u",
-                           WPA_GET_BE16(ap->pri_dev_type),
-                           WPA_GET_BE32(ap->pri_dev_type + 2),
-                           WPA_GET_BE16(ap->pri_dev_type + 6));
+               wps_dev_type_bin2str(ap->pri_dev_type, dev_type,
+                                    sizeof(dev_type));
        else
                dev_type[0] = '\0';
 
@@ -450,14 +448,12 @@ static void wpa_supplicant_wps_event_er_enrollee_add(
        struct wpa_supplicant *wpa_s, struct wps_event_er_enrollee *enrollee)
 {
        char uuid_str[100];
-       char dev_type[20];
+       char dev_type[WPS_DEV_TYPE_BUFSIZE];
 
        uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str));
        if (enrollee->pri_dev_type)
-               os_snprintf(dev_type, sizeof(dev_type), "%u-%08X-%u",
-                           WPA_GET_BE16(enrollee->pri_dev_type),
-                           WPA_GET_BE32(enrollee->pri_dev_type + 2),
-                           WPA_GET_BE16(enrollee->pri_dev_type + 6));
+               wps_dev_type_bin2str(enrollee->pri_dev_type, dev_type,
+                                    sizeof(dev_type));
        else
                dev_type[0] = '\0';