From: Naïm Favier Date: Mon, 7 Feb 2022 20:01:39 +0000 (+0100) Subject: wpa_supplicant: Use unique IDs for networks and credentials X-Git-Tag: hostap_2_11~2092 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0adc67612dab5a81088a832b1fd9629d3a2cada8;p=thirdparty%2Fhostap.git wpa_supplicant: Use unique IDs for networks and credentials The id and cred_id variables are reset to 0 every time the wpa_config_read() function is called, which is fine as long as it is only called once. However, this is not the case when using both the -c and -I options to specify two config files. This is a problem because the GUI, since commit eadfeb0e9374 ("wpa_gui: Show entire list of networks"), relies on the network IDs being unique (and increasing), and might get into an infinite loop otherwise. This is solved by simply making the variables static. Signed-off-by: Naïm Favier --- diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 2dd586391..9e7118532 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -297,8 +297,8 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp) struct wpa_ssid *ssid, *tail, *head; struct wpa_cred *cred, *cred_tail, *cred_head; struct wpa_config *config; - int id = 0; - int cred_id = 0; + static int id = 0; + static int cred_id = 0; if (name == NULL) return NULL;