From: Aki Tuomi Date: Mon, 14 Sep 2015 11:35:51 +0000 (+0300) Subject: Escape portal identifier X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~46^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01f7776cc9a79a2d8e362194c5a6ed8384b2de2e;p=pdns Escape portal identifier --- diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index 18f07d587..d7c3fcc50 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -96,8 +96,10 @@ public: // by stored procedures. you can return more than one // if you return SETOF refcursor. if (PQftype(d_res_set, 0) == 1790) { // REFCURSOR - string portal = string(PQgetvalue(d_res_set, d_cur_set++, 0)); - string cmd = string("FETCH ALL FROM \"") + portal + string("\""); + char *val = PQgetvalue(d_res_set, d_cur_set++, 0); + char *portal = PQescapeIdentifier(d_db(), val, strlen(val)); + string cmd = string("FETCH ALL FROM \"") + string(portal) + string("\""); + PQfreemem(portal); // execute FETCH if (d_dolog) L<