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

0x04 was being checked from incorrect location when skipping country
code validation.
This commit is contained in:
Jouni Malinen 2010-06-28 14:32:17 -07:00 committed by Jouni Malinen
parent 18708aadfc
commit 9e00ea1aa3
1 changed files with 2 additions and 2 deletions

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