P2PS: Fix P2P_FIND seek parameter parsing
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 18 Jun 2015 14:01:02 +0000 (17:01 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 18 Jun 2015 14:27:30 +0000 (17:27 +0300)
Only the first seek=<service name> parameter was accepted from the
P2P_FIND command. Fix this to go through all seek parameters to
construct the list of service hash values to seek.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/ctrl_iface.c

index 4984399..3a32917 100644 (file)
@@ -4597,16 +4597,20 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
 
        /* Must be searched for last, because it adds nul termination */
        pos = os_strstr(cmd, " seek=");
+       if (pos)
+               pos += 6;
        while (pos && seek_count < P2P_MAX_QUERY_HASH + 1) {
                char *term;
 
-               term = os_strchr(pos + 1, ' ');
-               _seek[seek_count++] = pos + 6;
+               _seek[seek_count++] = pos;
                seek = _seek;
-               pos = os_strstr(pos + 6, " seek=");
-
-               if (term)
-                       *term = '\0';
+               term = os_strchr(pos, ' ');
+               if (!term)
+                       break;
+               *term = '\0';
+               pos = os_strstr(term + 1, "seek=");
+               if (pos)
+                       pos += 5;
        }
        if (seek_count > P2P_MAX_QUERY_HASH) {
                seek[0] = NULL;