From 5a23c2528a5b9fc00e3282720d5828ed49f1a77b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 23 Feb 2019 13:57:51 +0200 Subject: [PATCH] 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 --- src/rsn_supp/tdls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c index 345b0c84d..704c95e68 100644 --- a/src/rsn_supp/tdls.c +++ b/src/rsn_supp/tdls.c @@ -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; }