u16 comeback_delay, resp_len;
const u8 *pos, *adv_proto;
int prot, pmf;
+ unsigned int left;
if (gas == NULL || len < 4)
return -1;
resp_len = WPA_GET_LE16(pos);
pos += 2;
- if (pos + resp_len > data + len) {
+ left = data + len - pos;
+ if (resp_len > left) {
wpa_printf(MSG_DEBUG, "GAS: Truncated Query Response in "
"response from " MACSTR, MAC2STR(sa));
return 0;
}
- if (pos + resp_len < data + len) {
+ if (resp_len < left) {
wpa_printf(MSG_DEBUG, "GAS: Ignore %u octets of extra data "
"after Query Response from " MACSTR,
- (unsigned int) (data + len - pos - resp_len),
- MAC2STR(sa));
+ left - resp_len, MAC2STR(sa));
}
if (action == WLAN_PA_GAS_COMEBACK_RESP)