UBSan: Use typecast to avoid unsigned integer overflow
iface->num_bss is unsigned integer, so need to explicit typecast it to unsigned before decrementation by one even when the result is stored in an unsigned integer. ../src/ap/hostapd.c:2185:26: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned long' Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e3b5bd81bd
commit
1b85cad29c
1 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* hostapd / Initialization and configuration
|
||||
* Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2002-2019, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
|
@ -2182,7 +2182,7 @@ void hostapd_interface_deinit(struct hostapd_iface *iface)
|
|||
}
|
||||
#endif /* CONFIG_FST */
|
||||
|
||||
for (j = iface->num_bss - 1; j >= 0; j--) {
|
||||
for (j = (int) iface->num_bss - 1; j >= 0; j--) {
|
||||
if (!iface->bss)
|
||||
break;
|
||||
hostapd_bss_deinit(iface->bss[j]);
|
||||
|
|
Loading…
Reference in a new issue