Commit f33ddb46 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(snmp) validate location, contact for ascii set. closes https://github.com/opnsense/core/issues/939

(cherry picked from commit 52e5e3a3)
parent 661372ce
...@@ -66,10 +66,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -66,10 +66,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// input validation // input validation
if (strstr($pconfig['syslocation'],"#")) { if (strstr($pconfig['syslocation'],"#")) {
$input_errors[] = gettext("Invalid character '#' in system location"); $input_errors[] = gettext("Invalid character '#' in system location");
} elseif (preg_match('/[^\x20-\x7f]/', $pconfig['syslocation'])) {
$input_errors[] = gettext("Invalid character (non ascii) in system location");
} }
if (strstr($pconfig['syscontact'],"#")) { if (strstr($pconfig['syscontact'],"#")) {
$input_errors[] = gettext("Invalid character '#' in system contact"); $input_errors[] = gettext("Invalid character '#' in system contact");
} elseif (preg_match('/[^\x20-\x7f]/', $pconfig['syscontact'])) {
$input_errors[] = gettext("Invalid character (non ascii) in system contact");
} }
if (strstr($pconfig['rocommunity'],"#")) { if (strstr($pconfig['rocommunity'],"#")) {
$input_errors[] = gettext("Invalid character '#' in read community string"); $input_errors[] = gettext("Invalid character '#' in read community string");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment