Skip to content

Commit e5f1ba4

Browse files
committed
Fixes #6885
1 parent c9a99a9 commit e5f1ba4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

interface/web/monitor/show_sys_state.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@
3636
/* Change the Server if needed */
3737
if (isset($_GET['server'])) {
3838
$server = explode('|', $_GET['server'], 2);
39+
40+
// Validate server_id (should be numeric)
41+
if (!isset($server[0]) || !is_numeric($server[0])) {
42+
$app->error('Invalid server ID');
43+
exit;
44+
}
45+
46+
// Validate server_name (allow alphanumeric, spaces, hyphens, dots, underscores, and parentheses)
47+
if (!isset($server[1]) || !preg_match('/^[a-zA-Z0-9\s\-\._()]+$/', $server[1]) || strlen($server[1]) > 60) {
48+
$app->error('Invalid server name');
49+
exit;
50+
}
51+
3952
$_SESSION['monitor']['server_id'] = $server[0];
4053
$_SESSION['monitor']['server_name'] = $server[1];
4154
}
@@ -105,6 +118,11 @@
105118
*/
106119
$refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0;
107120

121+
// Ensure refresh value is within acceptable range (0-3600 seconds)
122+
if ($refresh < 0 || $refresh > 3600) {
123+
$refresh = 0; // Reset to default if invalid
124+
}
125+
108126
$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -', '5' => '5 '.$app->lng("minutes"), '10' => '10 '.$app->lng("minutes"), '15' => '15 '.$app->lng("minutes"), '30' => '30 '.$app->lng("minutes"), '60' => '60 '.$app->lng("minutes"));
109127
$tmp = '';
110128
foreach($refresh_values as $key => $val) {

0 commit comments

Comments
 (0)