Message ID | 211e7c80-1464-4f1b-a9ec-09ffab62637a@xv97.com |
---|---|
State | Accepted |
Headers | show |
Series | wpa_supplicant: Fix ignoring boundary 0 in config parser | expand |
On Thu, Feb 29, 2024 at 09:44:12PM +0800, Chien Wong wrote: > The following config file contains invalid items: > ---- > filter_rssi=1234 # should be rejected > > network={ > mode=-1 # should be rejected > ssid="ssid" > psk="password" > } > ---- > But it is accepted by the config parser. The issue is due to using NULL > to represent no limit. If a boundary is set to 0, it's disregarded. > Fix this. > Note that string parser is not affected as length cannot be negative and > we are not limiting any string to be always empty. Thanks, applied.
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index f400b50cf..b81b9173e 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -197,9 +197,10 @@ static char * wpa_config_write_str(const struct parse_data *data, #endif /* NO_CONFIG_WRITE */ -static int wpa_config_parse_int(const struct parse_data *data, - struct wpa_ssid *ssid, - int line, const char *value) +static int wpa_config_parse_int_impl(const struct parse_data *data, + struct wpa_ssid *ssid, + int line, const char *value, + bool check_range) { int val, *dst;