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

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


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

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



Modified: branches/2.4/postgis/lwgeom_export.c
===================================================================
--- branches/2.4/postgis/lwgeom_export.c	2019-10-02 18:22:09 UTC (rev 17851)
+++ branches/2.4/postgis/lwgeom_export.c	2019-10-02 18:22:16 UTC (rev 17852)
@@ -68,10 +68,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