]> git.ipfire.org Git - thirdparty/hostap.git/commit
UBSan: Avoid size_t variable overflow in control interface
authorJouni Malinen <j@w1.fi>
Sat, 23 Feb 2019 10:49:17 +0000 (12:49 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 25 Feb 2019 17:42:50 +0000 (19:42 +0200)
commit01d01a311c52d56709eaadc5ffbbe7a7d773b041
treea7faa756874ad190e15ddc3c578b4816455e3155
parentec2e7c4cfa171dca26977ce64953b289e2640794
UBSan: Avoid size_t variable overflow in control interface

The loop "if (i-- == 0) break" style construction works in practice fine
since the check against 0 is done before decrementation. However, this
hits an UBSan warning, so split that decrementation to happen as a
separate step after the check and break from the loop.

ctrl_iface.c:5086:9: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/ctrl_iface.c