WMM: Fix estimated medium time calculation for some corner cases
It was possible for the int medium_time variable to overflow, so use a 64-bit unsigned integer to get a large enough value for the multiplication. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ae26d30213
commit
0d60567030
1 changed files with 6 additions and 4 deletions
10
src/ap/wmm.c
10
src/ap/wmm.c
|
@ -152,8 +152,9 @@ static void wmm_send_action(struct hostapd_data *hapd, const u8 *addr,
|
||||||
|
|
||||||
int wmm_process_tspec(struct wmm_tspec_element *tspec)
|
int wmm_process_tspec(struct wmm_tspec_element *tspec)
|
||||||
{
|
{
|
||||||
int medium_time, pps, duration;
|
u64 medium_time;
|
||||||
int up, psb, dir, tid;
|
unsigned int pps, duration;
|
||||||
|
unsigned int up, psb, dir, tid;
|
||||||
u16 val, surplus;
|
u16 val, surplus;
|
||||||
|
|
||||||
up = (tspec->ts_info[1] >> 3) & 0x07;
|
up = (tspec->ts_info[1] >> 3) & 0x07;
|
||||||
|
@ -201,8 +202,9 @@ int wmm_process_tspec(struct wmm_tspec_element *tspec)
|
||||||
return WMM_ADDTS_STATUS_INVALID_PARAMETERS;
|
return WMM_ADDTS_STATUS_INVALID_PARAMETERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
medium_time = surplus * pps * duration / 0x2000;
|
medium_time = (u64) surplus * pps * duration / 0x2000;
|
||||||
wpa_printf(MSG_DEBUG, "WMM: Estimated medium time: %u", medium_time);
|
wpa_printf(MSG_DEBUG, "WMM: Estimated medium time: %lu",
|
||||||
|
(unsigned long) medium_time);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: store list of granted (and still active) TSPECs and check
|
* TODO: store list of granted (and still active) TSPECs and check
|
||||||
|
|
Loading…
Reference in a new issue