mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-17 17:43:06 -05:00
P2P: Validate the freq in p2p_group_add
Add additional input verification for the frequency parameter in p2p_group_add (and other P2P operations for that matter). Without this verification invalid freq could be set and not handled properly. Signed-hostap: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
973622cd44
commit
d393de1d27
@ -109,6 +109,9 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
|
|||||||
{
|
{
|
||||||
/* TODO: more operating classes */
|
/* TODO: more operating classes */
|
||||||
if (freq >= 2412 && freq <= 2472) {
|
if (freq >= 2412 && freq <= 2472) {
|
||||||
|
if ((freq - 2407) % 5)
|
||||||
|
return -1;
|
||||||
|
|
||||||
*op_class = 81; /* 2.407 GHz, channels 1..13 */
|
*op_class = 81; /* 2.407 GHz, channels 1..13 */
|
||||||
*channel = (freq - 2407) / 5;
|
*channel = (freq - 2407) / 5;
|
||||||
return 0;
|
return 0;
|
||||||
@ -121,12 +124,18 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (freq >= 5180 && freq <= 5240) {
|
if (freq >= 5180 && freq <= 5240) {
|
||||||
|
if ((freq - 5000) % 5)
|
||||||
|
return -1;
|
||||||
|
|
||||||
*op_class = 115; /* 5 GHz, channels 36..48 */
|
*op_class = 115; /* 5 GHz, channels 36..48 */
|
||||||
*channel = (freq - 5000) / 5;
|
*channel = (freq - 5000) / 5;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freq >= 5745 && freq <= 5805) {
|
if (freq >= 5745 && freq <= 5805) {
|
||||||
|
if ((freq - 5000) % 5)
|
||||||
|
return -1;
|
||||||
|
|
||||||
*op_class = 124; /* 5 GHz, channels 149..161 */
|
*op_class = 124; /* 5 GHz, channels 149..161 */
|
||||||
*channel = (freq - 5000) / 5;
|
*channel = (freq - 5000) / 5;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user