FIX #GHSA-hq5j-39f9-qxcv

This commit is contained in:
Laurent Destailleur 2026-04-03 22:45:33 +02:00
parent 811cc1c275
commit b18f4ecc69
2 changed files with 7 additions and 7 deletions

View file

@ -2056,7 +2056,7 @@ class Project extends CommonObject
public function update_element($tableName, $elementSelectId)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX.$tableName;
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->db->sanitize($tableName);
if ($tableName == "actioncomm") {
$sql .= " SET fk_project=".$this->id;
@ -2092,14 +2092,14 @@ class Project extends CommonObject
public function remove_element($tableName, $elementSelectId, $projectfield = 'fk_projet')
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX.$tableName;
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->db->sanitize($tableName);
if ($tableName == "actioncomm") {
$sql .= " SET fk_project=NULL";
$sql .= " WHERE id=".((int) $elementSelectId);
$sql .= " SET fk_project = NULL";
$sql .= " WHERE id = ".((int) $elementSelectId);
} else {
$sql .= " SET ".$projectfield."=NULL";
$sql .= " WHERE rowid=".((int) $elementSelectId);
$sql .= " SET ".$this->db->sanitize($projectfield)." = NULL";
$sql .= " WHERE rowid = ".((int) $elementSelectId);
}
dol_syslog(get_class($this)."::remove_element", LOG_DEBUG);

View file

@ -741,7 +741,7 @@ if (!empty($hookmanager->resArray)) {
}
if ($action == "addelement") {
$tablename = GETPOST("tablename");
$tablename = GETPOST("tablename", "aZ09");
$elementselectid = GETPOSTINT("elementselect");
$result = $object->update_element($tablename, $elementselectid);
if ($result < 0) {