1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Sanitize input with escapeshellarg()

This commit is contained in:
billz 2023-03-29 08:25:18 +02:00
parent dda1fe6bbb
commit 1e52ff598b

View File

@ -98,15 +98,15 @@ function DisplayHostAPDConfig()
$arrConfig['country_code'] = $country_code[0]; $arrConfig['country_code'] = $country_code[0];
} }
// set txpower with iw if value is non-default ('auto') // set txpower with iw if value is non-default ('auto')
if (isset($_POST['txpower']) && ($_POST['txpower'] != 'auto')) { $txpower = escapeshellarg($_POST['txpower']);
$sdBm = $_POST['txpower'] * 100; $interface = escapeshellarg($_POST['interface']);
exec('sudo /sbin/iw dev '.$_POST['interface'].' set txpower fixed '.$sdBm, $return); if ($txpower) && ($txpower != 'auto')) {
$status->addMessage('Setting transmit power to '.$_POST['txpower'].' dBm.', 'success'); $sdBm = $txpower * 100;
$txpower = $_POST['txpower']; exec('sudo /sbin/iw dev '.$interface.' set txpower fixed '.$sdBm, $return);
} elseif ($_POST['txpower'] == 'auto') { $status->addMessage('Setting transmit power to '.$txpower.' dBm.', 'success');
exec('sudo /sbin/iw dev '.$_POST['interface'].' set txpower auto', $return); } elseif ($txpower == 'auto') {
$status->addMessage('Setting transmit power to '.$_POST['txpower'].'.', 'success'); exec('sudo /sbin/iw dev '.$interface.' set txpower auto', $return);
$txpower = $_POST['txpower']; $status->addMessage('Setting transmit power to '.$txpower.'.', 'success');
} }
$countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2; $countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2;