properly escape class parameter

The class parameter was used as is, allowing for potential
SQL injection via the API.

Thanks to @bladeswords for finding this.
This commit is contained in:
Sarah Hoffmann
2020-05-02 23:01:27 +02:00
parent 627a487fcf
commit f549379e31

View File

@@ -37,7 +37,7 @@ if ($sOsmType && $iOsmId > 0) {
); );
// osm_type and osm_id are not unique enough // osm_type and osm_id are not unique enough
if ($sClass) { if ($sClass) {
$sSQL .= " AND class='".$sClass."'"; $sSQL .= " AND class='".pg_escape_string($sClass)."'";
} }
$sSQL .= ' ORDER BY class ASC'; $sSQL .= ' ORDER BY class ASC';
$sPlaceId = chksql($oDB->getOne($sSQL)); $sPlaceId = chksql($oDB->getOne($sSQL));