D-Bus: Use size_t for values theoretically larger than 16-bit int

These are theoretical cases with 32-bit integers, but cases that could
potentially hit an integer overflow with 16-bit int.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-03-22 17:24:21 +02:00
parent d2d16e3100
commit a2c23195ad

View file

@ -1146,7 +1146,7 @@ static int wpas_dbus_get_scan_ies(DBusMessage *message, DBusMessageIter *var,
DBusMessage **reply) DBusMessage **reply)
{ {
u8 *ies = NULL, *nies; u8 *ies = NULL, *nies;
int ies_len = 0; size_t ies_len = 0;
DBusMessageIter array_iter, sub_array_iter; DBusMessageIter array_iter, sub_array_iter;
char *val; char *val;
int len; int len;
@ -1177,7 +1177,7 @@ static int wpas_dbus_get_scan_ies(DBusMessage *message, DBusMessageIter *var,
dbus_message_iter_recurse(&array_iter, &sub_array_iter); dbus_message_iter_recurse(&array_iter, &sub_array_iter);
dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len); dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len);
if (len == 0) { if (len <= 0) {
dbus_message_iter_next(&array_iter); dbus_message_iter_next(&array_iter);
continue; continue;
} }
@ -1208,7 +1208,7 @@ static int wpas_dbus_get_scan_channels(DBusMessage *message,
{ {
DBusMessageIter array_iter, sub_array_iter; DBusMessageIter array_iter, sub_array_iter;
int *freqs = NULL, *nfreqs; int *freqs = NULL, *nfreqs;
int freqs_num = 0; size_t freqs_num = 0;
if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_ARRAY) { if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_ARRAY) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,