FIX #GHSA-hq5j-39f9-qxcv

This commit is contained in:
Laurent Destailleur 2026-04-03 22:45:33 +02:00
parent 15c46ce0eb
commit 7ada112211
2 changed files with 4 additions and 4 deletions

View file

@ -2046,7 +2046,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 = ".((int) $this->id);
@ -2082,13 +2082,13 @@ 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);
} else {
$sql .= " SET ".$projectfield." = NULL";
$sql .= " SET ".$this->db->sanitize($projectfield)." = NULL";
$sql .= " WHERE rowid = ".((int) $elementSelectId);
}

View file

@ -832,7 +832,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) {