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

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


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

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


Modified: trunk/postgis/lwgeom_export.c
===================================================================
--- trunk/postgis/lwgeom_export.c	2019-10-02 17:12:26 UTC (rev 17850)
+++ trunk/postgis/lwgeom_export.c	2019-10-02 18:22:09 UTC (rev 17851)
@@ -77,10 +77,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