Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

FIX: Sanitize and bind graph configuration queries 22.04.x #11729

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions www/class/centreonGraph.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1133,13 +1133,15 @@ public function setTemplate($template_id = null)
} else {
$this->templateId = htmlentities($_GET["template_id"], ENT_QUOTES, "UTF-8");
}
$DBRESULT = $this->DB->query(
$statement = $this->DB->prepare(
"SELECT *
FROM giv_graphs_template
WHERE graph_id = '" . $this->templateId . "' LIMIT 1"
WHERE graph_id = :graph_id LIMIT 1"
);
$this->templateInformations = $DBRESULT->fetch();
$DBRESULT->closeCursor();
$statement->bindValue(':graph_id', (int) $this->templateId, \PDO::PARAM_INT);
$statement->execute();
$this->templateInformations = $statement->fetch(\PDO::FETCH_ASSOC);
$statement->closeCursor();
}

/**
Expand Down