From b4525bfee8035d372d238aa4a252bbc0113d17cb Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 14 Jul 2008 00:42:07 +0000 Subject: [PATCH] * Add invalid characters for description input error * Do not save the data when input_errors are set --- usr/local/www/vpn_openvpn_certs_create.php | 44 ++++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/usr/local/www/vpn_openvpn_certs_create.php b/usr/local/www/vpn_openvpn_certs_create.php index 17636521bb..eabaebc9fc 100644 --- a/usr/local/www/vpn_openvpn_certs_create.php +++ b/usr/local/www/vpn_openvpn_certs_create.php @@ -63,7 +63,9 @@ if ($_GET['ca']) { } if ($_POST) { - $descr = str_replace($_POST['descr'], " ", ""); // spaces can be deadly + if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['descr'])) + $input_errors[] = "Description contains invalid characters."; + $descr = $_POST['descr']; $cakeysize = $_POST['cakeysize']; $caexpire = $_POST['caexpire']; $cakeyexpire = $_POST['cakeyexpire']; @@ -198,26 +200,28 @@ if ($_POST) {