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

FIX: Sanitize and bind Knowledge Base host listing 21.10.x #11859

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
14 changes: 8 additions & 6 deletions www/class/centreon-knowledge/procedures.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ public function getMyHostMultipleTemplateModels($host_id = null)
"WHERE host_host_id = '" . $host_id . "' " .
"ORDER BY `order`"
);
$statement = $this->centreon_DB->prepare(
"SELECT host_name " .
"FROM host " .
"WHERE host_id = :host_id LIMIT 1"
);
while ($row = $dbResult->fetch()) {
$dbResult2 = $this->centreon_DB->query(
"SELECT host_name " .
"FROM host " .
"WHERE host_id = '" . $row['host_tpl_id'] . "' LIMIT 1"
);
$hTpl = $dbResult2->fetch();
$statement->bindValue(':host_id', $row['host_tpl_id'], \PDO::PARAM_INT);
$statement->execute();
$hTpl = $statement->fetch(\PDO::FETCH_ASSOC);
$tplArr[$row['host_tpl_id']] = html_entity_decode($hTpl["host_name"], ENT_QUOTES);
}
unset($row);
Expand Down