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

Commit

Permalink
fix(xss): fix SQL injection for GET parameter
Browse files Browse the repository at this point in the history
- Fix $_GET['host_id'] => parse it as integer
- remove unnecessary ';' in code
  • Loading branch information
Dimitar Kalinov committed Feb 26, 2019
1 parent dd52e85 commit 2db2327
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions www/include/views/graphs/common/makeXML_ListServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
putenv("LANG=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", _CENTREON_PATH_ . "www/locale/");
;
bind_textdomain_codeset("messages", "UTF-8");
textdomain("messages");

Expand All @@ -71,7 +70,7 @@
$mx_l = strlen($s_datas[""]);

if (isset($_GET["host_id"]) && $_GET["host_id"] != 0) {
$pq_sql = $pearDBO->query("SELECT id index_id, service_description FROM index_data WHERE host_id='".$_GET['host_id']."'ORDER BY service_description");
$pq_sql = $pearDBO->query("SELECT id index_id, service_description FROM index_data WHERE host_id=".(int)$_GET['host_id']." ORDER BY service_description");
while ($fw_sql = $pq_sql->fetchRow()) {
$fw_sql["service_description"] = str_replace($a_this, $a_that, $fw_sql["service_description"]);
$s_datas[$fw_sql["index_id"]] = $fw_sql["service_description"]."   ";
Expand All @@ -85,4 +84,4 @@
for ($i = strlen($s_datas[""]); $i != $mx_l; $i++) {
$s_datas[""] .= " ";
}
$buffer->output();
$buffer->output();

0 comments on commit 2db2327

Please sign in to comment.