From c62d68f4be9df097b0f84a57212cc38caea40a03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Mar 2018 01:21:44 +0100 Subject: [PATCH] Fix SQLi reported by op7ica --- htdocs/core/lib/functions2.lib.php | 4 ++-- htdocs/societe/card.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 49a2f12db03..25c47632a14 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1451,7 +1451,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) foreach ($tab as $key => $value) { if ($i > 0) $sql.=','; - $sql.="'".$key."'"; + $sql.="'".$this->db->escape($key)."'"; $i++; } $sql.= ")"; @@ -1472,7 +1472,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,entity,param,value)"; $sql.= " VALUES (".$user->id.",".$conf->entity.","; - $sql.= " '".$key."','".$db->escape($value)."')"; + $sql.= " '".$this->db->escape($key)."','".$db->escape($value)."')"; dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG); $result=$db->query($sql); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b296f65ad5e..a99fc26a574 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1682,12 +1682,12 @@ else } else if ($object->codeclient_modifiable()) { - print ''; + print ''; } else { print $object->code_client; - print ''; + print ''; } print ''; $s=$modCodeClient->getToolTip($langs,$object,0);