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

Commit

Permalink
Fix : Sanitize and bind centreon hostgroups class (#11800)
Browse files Browse the repository at this point in the history
  • Loading branch information
emabassi-ext authored Sep 21, 2022
1 parent 7da7260 commit 683b485
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions www/class/centreonHostgroups.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,19 @@ public function getHostGroupHosts($hg_id = null)
}

$hosts = array();
$DBRESULT = $this->DB->query(
"SELECT hgr.host_host_id " .
$statement = $this->DB->prepare("SELECT hgr.host_host_id " .
"FROM hostgroup_relation hgr, host h " .
"WHERE hgr.hostgroup_hg_id = '" . $this->DB->escape($hg_id) . "' " .
"WHERE hgr.hostgroup_hg_id = :hgId " .
"AND h.host_id = hgr.host_host_id " .
"ORDER by h.host_name"
);
while ($elem = $DBRESULT->fetchRow()) {
"ORDER by h.host_name");
$statement->bindValue(':hgId', (int) $hg_id, \PDO::PARAM_INT);
$statement->execute();

while ($elem = $statement->fetchRow()) {
$ref[$elem["host_host_id"]] = $elem["host_host_id"];
$hosts[] = $elem["host_host_id"];
}
$DBRESULT->closeCursor();
$statement->closeCursor();
unset($elem);

if (isset($hostgroups) && count($hostgroups)) {
Expand Down

0 comments on commit 683b485

Please sign in to comment.