hostapd: Validate the country_code parameter value
cfg80211/regulatory supports only ISO 3166-1 alpha2 country code and that's what this parameter is supposed to use, so validate the country code input before accepting the value. Only characters A..Z are accepted. Signed-off-by: Sriram R <srirrama@codeaurora.org>
This commit is contained in:
parent
d4f5d1f0c7
commit
e149051ced
1 changed files with 7 additions and 0 deletions
|
@ -2463,6 +2463,13 @@ static int hostapd_config_fill(struct hostapd_config *conf,
|
||||||
} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
|
} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
|
||||||
bss->skip_inactivity_poll = atoi(pos);
|
bss->skip_inactivity_poll = atoi(pos);
|
||||||
} else if (os_strcmp(buf, "country_code") == 0) {
|
} else if (os_strcmp(buf, "country_code") == 0) {
|
||||||
|
if (pos[0] < 'A' || pos[0] > 'Z' ||
|
||||||
|
pos[1] < 'A' || pos[1] > 'Z') {
|
||||||
|
wpa_printf(MSG_ERROR,
|
||||||
|
"Line %d: Invalid country_code '%s'",
|
||||||
|
line, pos);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
os_memcpy(conf->country, pos, 2);
|
os_memcpy(conf->country, pos, 2);
|
||||||
} else if (os_strcmp(buf, "country3") == 0) {
|
} else if (os_strcmp(buf, "country3") == 0) {
|
||||||
conf->country[2] = strtol(pos, NULL, 16);
|
conf->country[2] = strtol(pos, NULL, 16);
|
||||||
|
|
Loading…
Reference in a new issue