UBSan: Avoid an unsigned integer overflow warning

ext_supp_rates_len would be 0 here, so decrementing it by 2 will result
in unsigned integer overflow even if that result is not actually used
anywhere. Avoid that to get rid of the UBSan warning.

tdls.c:1597:27: runtime error: unsigned integer overflow: 0 - 2 cannot be represented in type 'unsigned long'

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-23 13:57:51 +02:00
parent abde4eba45
commit 5a23c2528a
1 changed files with 1 additions and 1 deletions

View File

@ -1594,7 +1594,7 @@ static int copy_supp_rates(const struct wpa_eapol_ie_parse *kde,
peer->supp_rates, sizeof(peer->supp_rates),
kde->supp_rates + 2, kde->supp_rates_len - 2,
kde->ext_supp_rates ? kde->ext_supp_rates + 2 : NULL,
kde->ext_supp_rates_len - 2);
kde->ext_supp_rates ? kde->ext_supp_rates_len - 2 : 0);
return 0;
}