diff options
author | Renato Botelho <renato@netgate.com> | 2016-06-08 14:10:50 -0400 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-06-08 19:03:52 -0400 |
commit | b926fb222ccbea2948c1ef89b110366d6a469449 (patch) | |
tree | 6623cfcfabfc327aa9f7c676401f360a806b2732 /src/usr | |
parent | d38ccd2bc5df7403a32ab0dc87741838c0f8c587 (diff) | |
download | pfsense-b926fb222ccbea2948c1ef89b110366d6a469449.zip pfsense-b926fb222ccbea2948c1ef89b110366d6a469449.tar.gz |
Simplify mode parameter validation
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/pkg_mgr_install.php | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php index b5ce5b0..771fe6c 100644 --- a/src/usr/local/www/pkg_mgr_install.php +++ b/src/usr/local/www/pkg_mgr_install.php @@ -221,23 +221,20 @@ function waitfor_string_in_file($filename, $string, $timeout) { } $pkgmode = ''; -if (!empty($_POST['mode'])) { - $pkgmode = $_POST['mode']; -} elseif (!empty($_GET['mode'])) { - $pkgmode = $_GET['mode']; -} +if (!empty($_REQUEST['mode'])) { + $valid_modes = array( + 'reinstallall', + 'reinstallpkg', + 'delete', + 'installed' + ); + + if (!in_array($_REQUEST['mode'], $valid_modes)) { + header("Location: pkg_mgr_installed.php"); + return; + } -$valid_modes = array( - '', - 'reinstallall', - 'reinstallpkg', - 'delete', - 'installed' -); - -if (!in_array($pkgmode, $valid_modes)) { - header("Location: pkg_mgr_installed.php"); - return; + $pkgmode = $_REQUEST['mode']; } if ($_POST) { |