[postgis-tickets] r17853 - Use snprintf in building SRID query string

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 2 11:22:22 PDT 2019


Author: pramsey
Date: 2019-10-02 11:22:22 -0700 (Wed, 02 Oct 2019)
New Revision: 17853

Modified:
   branches/2.5/postgis/lwgeom_export.c
Log:
Use snprintf in building SRID query string



Modified: branches/2.5/postgis/lwgeom_export.c
===================================================================
--- branches/2.5/postgis/lwgeom_export.c	2019-10-02 18:22:16 UTC (rev 17852)
+++ branches/2.5/postgis/lwgeom_export.c	2019-10-02 18:22:22 UTC (rev 17853)
@@ -69,10 +69,10 @@
 	}
 
 	if (short_crs)
-		sprintf(query, "SELECT auth_name||':'||auth_srid \
+		snprintf(query, 256, "SELECT auth_name||':'||auth_srid \
 		        FROM spatial_ref_sys WHERE srid='%d'", srid);
 	else
-		sprintf(query, "SELECT 'urn:ogc:def:crs:'||auth_name||'::'||auth_srid \
+		snprintf(query, 256, "SELECT 'urn:ogc:def:crs:'||auth_name||'::'||auth_srid \
 		        FROM spatial_ref_sys WHERE srid='%d'", srid);
 
 	err = SPI_exec(query, 1);



More information about the postgis-tickets mailing list