From cbfe4963fa732dcc58e8b0444bfe530b4f6d3feb Mon Sep 17 00:00:00 2001
From: Alex Orluc <alex.orluc@maarch.org>
Date: Thu, 30 Oct 2014 11:21:15 +0000
Subject: [PATCH] FIX #1640 replace special char to avoid sql injection

---
 core/trunk/core/class/class_security.php | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/core/trunk/core/class/class_security.php b/core/trunk/core/class/class_security.php
index 1dfc737acad..394415649a7 100644
--- a/core/trunk/core/class/class_security.php
+++ b/core/trunk/core/class/class_security.php
@@ -92,6 +92,18 @@ class security extends dbquery
         $array = array();
         $error = '';
         $uc = new users_controler();
+
+	$s_login = str_replace('\'', '', $s_login);
+	$s_login = str_replace('=', '', $s_login);
+	$s_login = str_replace('"', '', $s_login);
+	$s_login = str_replace('*', '', $s_login);
+	$s_login = str_replace(';', '', $s_login);
+	$s_login = str_replace('--', '', $s_login);
+	$s_login = str_replace(',', '', $s_login);
+	$s_login = str_replace('$', '', $s_login);
+	$s_login = str_replace('>', '', $s_login);
+	$s_login = str_replace('<', '', $s_login);
+
         // #TODO : Not usefull anymore, loginmode field is always in users table
         //Compatibility test, if loginmode column doesn't exists, Maarch can't crash
         if ($this->test_column($_SESSION['tablename']['users'], 'loginmode')) {
-- 
GitLab