From f154e893d904596a0b37e77773d191b7e9b52cc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Mar 2023 21:38:56 +0100 Subject: [PATCH] Fix escaping --- htdocs/ticket/class/ticket.class.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 600436125a7..adf104d9ae9 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1872,20 +1872,18 @@ class Ticket extends CommonObject { $contacts = array(); - // Generation requete recherche + // Forge the search SQL $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople"; $sql .= " WHERE entity IN (".getEntity('contact').")"; if (!empty($socid)) { - $sql .= " AND fk_soc='".$this->db->escape($socid)."'"; + $sql .= " AND fk_soc = ".((int) $socid); } - if (!empty($email)) { $sql .= " AND "; - if (!$case) { - $sql .= "email LIKE '".$this->db->escape($email)."'"; + $sql .= "email = '".$this->db->escape($email)."'"; } else { - $sql .= "email LIKE BINARY '".$this->db->escape($email)."'"; + $sql .= "email LIKE BINARY '".$this->db->escape($this->db->escapeforlike($email))."'"; } }