]> granicus.if.org Git - pdns/commitdiff
Escape portal identifier
authorAki Tuomi <cmouse@cmouse.fi>
Mon, 14 Sep 2015 11:35:51 +0000 (14:35 +0300)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 14 Sep 2015 11:35:51 +0000 (14:35 +0300)
modules/gpgsqlbackend/spgsql.cc

index 18f07d5877d2833a873881b720ae6cee2aa2dd0a..d7c3fcc503bcedf9274582a9671fe59c29ae5d84 100644 (file)
@@ -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<<Logger::Warning<<"Query: "<<cmd<<endl;