From b68d602dc4435ab6a396c3a203adc1711f06c444 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 11 Dec 2014 01:41:48 +0200 Subject: [PATCH] Fix ANQP_GET/HS20_GET_ANQP parsing to skip space after address The space following the BSSID was not skipped properly if the following parameter started with the "hs20:" prefix. For other cases, atoi() ended up ignoring the space, but it is cleaner to skip it anyway for all cases. Signed-off-by: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 2e83e0571..2713d115c 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5375,6 +5375,8 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst) if (used < 0) return -1; pos = dst + used; + if (*pos == ' ') + pos++; while (num_id < MAX_ANQP_INFO_ID) { if (os_strncmp(pos, "hs20:", 5) == 0) { #ifdef CONFIG_HS20 @@ -5554,6 +5556,8 @@ static int get_hs20_anqp(struct wpa_supplicant *wpa_s, char *dst) if (used < 0) return -1; pos = dst + used; + if (*pos == ' ') + pos++; for (;;) { int num = atoi(pos); if (num <= 0 || num > 31)