system: fix off by one and add validation; closes #1581

This commit is contained in:
Franco Fichtner 2017-05-01 13:01:39 +02:00
parent 852657c789
commit 6d443755f0

View File

@ -332,6 +332,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
if (isset($pconfig['serial']) && ((string)((int)$pconfig['serial']) != $pconfig['serial'] || $pconfig['serial'] < 1)) {
$input_errors[] = gettext('The serial number must be a number greater than zero.');
}
/* save modifications */
if (count($input_errors) == 0) {
$ca = array();
@ -349,7 +353,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if (!empty($pconfig['serial'])) {
$ca['serial'] = $pconfig['serial'];
$ca['serial'] = $pconfig['serial'] - 1;
}
if (isset($id)) {