aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2020-03-22 15:46:45 (GMT)
committerJouni Malinen <j@w1.fi>2020-03-22 16:50:04 (GMT)
commitd2d16e3100ed15fffa3c475568689b3f1449e976 (patch)
tree7ab3531e965a8609278e5e75f24b7515300a37f9
parent4391ddd6395f63226ec3b14bcf325356653a614f (diff)
downloadhostap-d2d16e3100ed15fffa3c475568689b3f1449e976.zip
hostap-d2d16e3100ed15fffa3c475568689b3f1449e976.tar.gz
hostap-d2d16e3100ed15fffa3c475568689b3f1449e976.tar.bz2
Use size_t instead of int or unsigned int for configuration items
While int and unsigned int are not going overflow in practice as 32-bit values, these could at least in theory hit an integer overflow with 16-bit int. Use size_t to avoid such potential issue cases. Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--wpa_supplicant/config.c6
-rw-r--r--wpa_supplicant/config.h4
-rw-r--r--wpa_supplicant/events.c4
-rw-r--r--wpa_supplicant/scan.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 2b9c3f5..4f359ed 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2612,7 +2612,7 @@ static const struct parse_data ssid_fields[] = {
int wpa_config_add_prio_network(struct wpa_config *config,
struct wpa_ssid *ssid)
{
- int prio;
+ size_t prio;
struct wpa_ssid *prev, **nlist;
/*
@@ -4318,7 +4318,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
*/
void wpa_config_debug_dump_networks(struct wpa_config *config)
{
- int prio;
+ size_t prio;
struct wpa_ssid *ssid;
for (prio = 0; prio < config->num_prio; prio++) {
@@ -4649,7 +4649,7 @@ static int wpa_config_process_p2p_pref_chan(
struct wpa_config *config, int line, const char *pos)
{
struct p2p_channel *pref = NULL, *n;
- unsigned int num = 0;
+ size_t num = 0;
const char *pos2;
u8 op_class, chan;
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index b3c7792..486432e 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -332,7 +332,7 @@ struct wpa_cred {
*/
unsigned int max_bss_load;
- unsigned int num_req_conn_capab;
+ size_t num_req_conn_capab;
u8 *req_conn_capab_proto;
int **req_conn_capab_port;
@@ -403,7 +403,7 @@ struct wpa_config {
* This indicates how many per-priority network lists are included in
* pssid.
*/
- int num_prio;
+ size_t num_prio;
/**
* cred - Head of the credential list
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 2fc4993..3758373 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1536,7 +1536,7 @@ struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
struct wpa_ssid **selected_ssid)
{
struct wpa_bss *selected = NULL;
- int prio;
+ size_t prio;
struct wpa_ssid *next_ssid = NULL;
struct wpa_ssid *ssid;
@@ -1691,7 +1691,7 @@ int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
static struct wpa_ssid *
wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
{
- int prio;
+ size_t prio;
struct wpa_ssid *ssid;
for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index eef3517..ad9d77a 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -2628,8 +2628,8 @@ void wpa_scan_free_params(struct wpa_driver_scan_params *params)
int wpas_start_pno(struct wpa_supplicant *wpa_s)
{
- int ret, prio;
- size_t i, num_ssid, num_match_ssid;
+ int ret;
+ size_t prio, i, num_ssid, num_match_ssid;
struct wpa_ssid *ssid;
struct wpa_driver_scan_params params;
struct sched_scan_plan scan_plan;