mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
P2P: Add error message for invalid PIN
Reject invalid PIN value in p2p_connect command. Before this, typos like "pbd" as the third parameter could have resulted in OK return value since this parameter was interpreted as the PIN. Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
10ac7ddf33
commit
36ebf7a1b2
@ -2991,6 +2991,9 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
|
|||||||
} else if (os_strncmp(pos, "pbc", 3) == 0) {
|
} else if (os_strncmp(pos, "pbc", 3) == 0) {
|
||||||
wps_method = WPS_PBC;
|
wps_method = WPS_PBC;
|
||||||
} else {
|
} else {
|
||||||
|
char *end;
|
||||||
|
long int val;
|
||||||
|
|
||||||
pin = pos;
|
pin = pos;
|
||||||
pos = os_strchr(pin, ' ');
|
pos = os_strchr(pin, ' ');
|
||||||
wps_method = WPS_PIN_KEYPAD;
|
wps_method = WPS_PIN_KEYPAD;
|
||||||
@ -2999,6 +3002,12 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
|
|||||||
if (os_strncmp(pos, "display", 7) == 0)
|
if (os_strncmp(pos, "display", 7) == 0)
|
||||||
wps_method = WPS_PIN_DISPLAY;
|
wps_method = WPS_PIN_DISPLAY;
|
||||||
}
|
}
|
||||||
|
val = strtol(pin, &end, 10);
|
||||||
|
if (val < 0 || (os_strlen(pin) != 4 && os_strlen(pin) != 8) ||
|
||||||
|
*end != '\0') {
|
||||||
|
os_memcpy(buf, "FAIL-INVALID-PIN\n", 17);
|
||||||
|
return 17;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
|
new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
|
||||||
|
Loading…
Reference in New Issue
Block a user