P2P: Fix country string mismatch validation off-by-one offset
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 28 Jun 2010 21:32:17 +0000 (14:32 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:19 +0000 (07:17 -0700)
0x04 was being checked from incorrect location when skipping country
code validation.

src/p2p/p2p_go_neg.c

index dcd5dbd..f0d8f14 100644 (file)
@@ -54,9 +54,9 @@ int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
                return -1;
        os_memcpy(dev->country, pos, 3);
        wpa_hexdump_ascii(MSG_DEBUG, "P2P: Peer country", pos, 3);
-       if (pos[3] != 0x04 && os_memcmp(pos, p2p->cfg->country, 2) != 0) {
+       if (pos[2] != 0x04 && os_memcmp(pos, p2p->cfg->country, 2) != 0) {
                wpa_msg(p2p->cfg->msg_ctx, MSG_INFO,
-                       "P2P: Mismatching country (ours=%c%c peer's=%c%c",
+                       "P2P: Mismatching country (ours=%c%c peer's=%c%c)",
                        p2p->cfg->country[0], p2p->cfg->country[1],
                        pos[0], pos[1]);
                return -1;