Browse Source

P2P: Fix country string mismatch validation off-by-one offset

0x04 was being checked from incorrect location when skipping country
code validation.
Jouni Malinen 14 years ago
parent
commit
9e00ea1aa3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/p2p/p2p_go_neg.c

+ 2 - 2
src/p2p/p2p_go_neg.c

@@ -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;