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

FIX: Sanitize and bind service listing 21.10.x #11801

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,16 @@

$centreonToken = createCSRFToken();

$statement = $pearDB->prepare(
"SELECT COUNT(*) FROM host_service_relation WHERE service_service_id = :service_id"
);
for ($i = 0; $service = $dbResult->fetch(); $i++) {
//Get Number of Hosts linked to this one.
$dbResult2 = $pearDB->query(
"SELECT COUNT(*) FROM host_service_relation WHERE service_service_id = '" . $service["service_id"] . "'"
);
$data = $dbResult2->fetch();
$statement->bindValue(':service_id', $service["service_id"], \PDO::PARAM_INT);
$statement->execute();
$data = $statement->fetch(\PDO::FETCH_ASSOC);
$service["nbr"] = $data["COUNT(*)"];
$dbResult2->closeCursor();
$statement->closeCursor();
unset($data);

/**
Expand Down