[Tile-serving] [openstreetmap/osm2pgsql] Check more user-supplied strings used as SQL identifier (PR #1758)

Jochen Topf notifications at github.com
Fri Sep 9 06:33:22 UTC 2022


@joto commented on this pull request.



> @@ -197,6 +197,19 @@ std::string qualified_name(std::string const &schema, std::string const &name)
     return result;
 }
 
+void check_identifier(std::string const &name, char const *in)
+{
+    auto const pos = name.find_first_of("\"',.;$%&/()<>{}=?^*#");
+
+    if (pos == std::string::npos) {
+        return;
+    }
+
+    throw std::runtime_error{
+        "Special characters are not allowed in {} names: '{}'."_format(in,
+                                                                      name)};

The message can now be confusing, for instance for the `--prefix` option it will say:
`Special characters are not allowed in prefix names: '...'.` . Maybe just remove the `names`?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1758#pullrequestreview-1101763868
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/pull/1758/review/1101763868 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220908/813bd1e4/attachment.htm>


More information about the Tile-serving mailing list