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>
This commit is contained in:
parent
4391ddd639
commit
d2d16e3100
4 changed files with 9 additions and 9 deletions
|
@ -2612,7 +2612,7 @@ static const struct parse_data ssid_fields[] = {
|
||||||
int wpa_config_add_prio_network(struct wpa_config *config,
|
int wpa_config_add_prio_network(struct wpa_config *config,
|
||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
int prio;
|
size_t prio;
|
||||||
struct wpa_ssid *prev, **nlist;
|
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)
|
void wpa_config_debug_dump_networks(struct wpa_config *config)
|
||||||
{
|
{
|
||||||
int prio;
|
size_t prio;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
|
|
||||||
for (prio = 0; prio < config->num_prio; prio++) {
|
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 wpa_config *config, int line, const char *pos)
|
||||||
{
|
{
|
||||||
struct p2p_channel *pref = NULL, *n;
|
struct p2p_channel *pref = NULL, *n;
|
||||||
unsigned int num = 0;
|
size_t num = 0;
|
||||||
const char *pos2;
|
const char *pos2;
|
||||||
u8 op_class, chan;
|
u8 op_class, chan;
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ struct wpa_cred {
|
||||||
*/
|
*/
|
||||||
unsigned int max_bss_load;
|
unsigned int max_bss_load;
|
||||||
|
|
||||||
unsigned int num_req_conn_capab;
|
size_t num_req_conn_capab;
|
||||||
u8 *req_conn_capab_proto;
|
u8 *req_conn_capab_proto;
|
||||||
int **req_conn_capab_port;
|
int **req_conn_capab_port;
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ struct wpa_config {
|
||||||
* This indicates how many per-priority network lists are included in
|
* This indicates how many per-priority network lists are included in
|
||||||
* pssid.
|
* pssid.
|
||||||
*/
|
*/
|
||||||
int num_prio;
|
size_t num_prio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cred - Head of the credential list
|
* cred - Head of the credential list
|
||||||
|
|
|
@ -1536,7 +1536,7 @@ struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid **selected_ssid)
|
struct wpa_ssid **selected_ssid)
|
||||||
{
|
{
|
||||||
struct wpa_bss *selected = NULL;
|
struct wpa_bss *selected = NULL;
|
||||||
int prio;
|
size_t prio;
|
||||||
struct wpa_ssid *next_ssid = NULL;
|
struct wpa_ssid *next_ssid = NULL;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
|
|
||||||
|
@ -1691,7 +1691,7 @@ int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
|
||||||
static struct wpa_ssid *
|
static struct wpa_ssid *
|
||||||
wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
|
wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
int prio;
|
size_t prio;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
|
|
||||||
for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
|
for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
|
||||||
|
|
|
@ -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 wpas_start_pno(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
int ret, prio;
|
int ret;
|
||||||
size_t i, num_ssid, num_match_ssid;
|
size_t prio, i, num_ssid, num_match_ssid;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
struct wpa_driver_scan_params params;
|
struct wpa_driver_scan_params params;
|
||||||
struct sched_scan_plan scan_plan;
|
struct sched_scan_plan scan_plan;
|
||||||
|
|
Loading…
Reference in a new issue