From 9c79079e9cd5c53b61209bed6754ac6c06bbbda2 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 07 May 2015 07:52:47 -0400
Subject: [PATCH] Backported password generator patch

---
 interface/lib/classes/db_mysql.inc.php |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 6609ec9..7331463 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -132,13 +132,19 @@
 			
 			if($ids_config['sql_scan_enabled'] == 'yes') {
 				
+				// Remove whitespace
+				$string = trim($string);
+				if(substr($string,-1) == ';') $string = substr($string,0,-1);
+				
+				// Save original string
 				$string_orig = $string;
 				
 				//echo $string;
-				$chars = array(';', '#', '/*', '*/', '--', ' UNION ', '\\\'', '\\"');
+				$chars = array(';', '#', '/*', '*/', '--', '\\\'', '\\"');
 		
 				$string = str_replace('\\\\', '', $string);
-				$string = preg_replace('/(^|[^\\\])([\'"])(.*?[^\\\]?)\\2/is', '$1', $string);
+				$string = preg_replace('/(^|[^\\\])([\'"])\\2/is', '$1', $string);
+				$string = preg_replace('/(^|[^\\\])([\'"])(.*?[^\\\])\\2/is', '$1', $string);
 				$ok = true;
 
 				if(substr_count($string, "`") % 2 != 0 || substr_count($string, "'") % 2 != 0 || substr_count($string, '"') % 2 != 0) {

--
Gitblit v1.9.1