From 2e3b6b2fc8022df39600de4902ec302e5c2200c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Sep 2021 18:00:28 +0200 Subject: [PATCH] Backport sql injection fix from develop --- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/fourn/facture/card.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6859a510e93..02889c4c4ef 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -678,8 +678,8 @@ class Facture extends CommonInvoice $sql .= ", ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'" : "null"); $sql .= ", ".($user->id > 0 ? (int) $user->id : "null"); $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); - $sql .= ", ".$this->cond_reglement_id; - $sql .= ", ".$this->mode_reglement_id; + $sql .= ", ".((int) $this->cond_reglement_id); + $sql .= ", ".((int) $this->mode_reglement_id); $sql .= ", '".$this->db->idate($this->date_lim_reglement)."'"; $sql .= ", ".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null"); $sql .= ", ".($this->situation_cycle_ref ? "'".$this->db->escape($this->situation_cycle_ref)."'" : "null"); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a784431c841..04d99240f6b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -725,8 +725,8 @@ if (empty($reshook)) { $object->date_echeance = $datedue; $object->note_public = GETPOST('note_public', 'restricthtml'); $object->note_private = GETPOST('note_private', 'restricthtml'); - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->fk_account = GETPOST('fk_account', 'int'); $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); @@ -736,7 +736,7 @@ if (empty($reshook)) { $object->transport_mode_id = GETPOST('transport_mode_id', 'int'); // Proprietes particulieres a facture de remplacement - $object->fk_facture_source = GETPOST('fac_replacement'); + $object->fk_facture_source = GETPOST('fac_replacement', 'int'); $object->type = FactureFournisseur::TYPE_REPLACEMENT; $id = $object->createFromCurrent($user);