[GRASS-SVN] r57315 - in grass/trunk/lib: gis proj vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 29 01:22:20 PDT 2013


Author: hamish
Date: 2013-07-29 01:22:20 -0700 (Mon, 29 Jul 2013)
New Revision: 57315

Modified:
   grass/trunk/lib/gis/datum.c
   grass/trunk/lib/proj/get_proj.c
   grass/trunk/lib/vector/Vlib/hist.c
Log:
some fixes for 'error: format not a string literal and no format arguments [-Werror=format-security]'

Modified: grass/trunk/lib/gis/datum.c
===================================================================
--- grass/trunk/lib/gis/datum.c	2013-07-28 17:32:01 UTC (rev 57314)
+++ grass/trunk/lib/gis/datum.c	2013-07-29 08:22:20 UTC (rev 57315)
@@ -112,12 +112,12 @@
     int returnval = -1;
 
     if (NULL != G_find_key_value("datum", projinfo)) {
-	sprintf(datumname, G_find_key_value("datum", projinfo));
+	sprintf(datumname, "%s", G_find_key_value("datum", projinfo));
 	returnval = 1;
     }
 
     if (G_find_key_value("datumparams", projinfo) != NULL) {
-	sprintf(params, G_find_key_value("datumparams", projinfo));
+	sprintf(params, "%s", G_find_key_value("datumparams", projinfo));
 	returnval = 2;
     }
     else if (G_find_key_value("nadgrids", projinfo) != NULL) {

Modified: grass/trunk/lib/proj/get_proj.c
===================================================================
--- grass/trunk/lib/proj/get_proj.c	2013-07-28 17:32:01 UTC (rev 57314)
+++ grass/trunk/lib/proj/get_proj.c	2013-07-29 08:22:20 UTC (rev 57315)
@@ -133,7 +133,7 @@
 	     * key needs to be passed on. */
 	}
 	else if (strcmp(in_proj_keys->value[i], "defined") == 0)
-	    sprintf(buffa, in_proj_keys->key[i]);
+	    sprintf(buffa, "%s", in_proj_keys->key[i]);
 
 	else
 	    sprintf(buffa, "%s=%s",
@@ -190,7 +190,7 @@
 
     /* If datum parameters are present in the PROJ_INFO keys, pass them on */
     if (GPJ__get_datum_params(in_proj_keys, &datum, &params) == 2) {
-	sprintf(buffa, params);
+	sprintf(buffa, "%s", params);
 	alloc_options(buffa);
 	G_free(params);
 
@@ -200,7 +200,7 @@
     else if (datum != NULL) {
 
 	if (GPJ_get_default_datum_params_by_name(datum, &params) > 0) {
-	    sprintf(buffa, params);
+	    sprintf(buffa, "%s", params);
 	    alloc_options(buffa);
 	    returnval = 2;
 	    G_free(params);
@@ -247,7 +247,7 @@
 
     nsize = strlen(buffa);
     opt_in[nopt1++] = (char *)G_malloc(nsize + 1);
-    sprintf(opt_in[nopt1 - 1], buffa);
+    sprintf(opt_in[nopt1 - 1], "%s", buffa);
     return;
 }
 
@@ -272,7 +272,7 @@
 	sprintf(buffa, "proj=latlong ellps=WGS84");
 	nsize = strlen(buffa);
 	opt_in[nopt] = (char *)G_malloc(nsize + 1);
-	sprintf(opt_in[nopt++], buffa);
+	sprintf(opt_in[nopt++], "%s", buffa);
     }
     else {
 	/* Parameters have been provided; parse through them but don't
@@ -304,14 +304,14 @@
 			if (strcmp(info->proj, "ll") == 0)
 			    sprintf(buffa, "proj=latlong");
 			else
-			    sprintf(buffa, s);
+			    sprintf(buffa, "%s", s);
 		    }
 		    else {
-			sprintf(buffa, s);
+			sprintf(buffa, "%s", s);
 		    }
 		    nsize = strlen(buffa);
 		    opt_in[nopt] = (char *)G_malloc(nsize + 1);
-		    sprintf(opt_in[nopt++], buffa);
+		    sprintf(opt_in[nopt++], "%s", buffa);
 		}
 	    }
 	    s = 0;

Modified: grass/trunk/lib/vector/Vlib/hist.c
===================================================================
--- grass/trunk/lib/vector/Vlib/hist.c	2013-07-28 17:32:01 UTC (rev 57314)
+++ grass/trunk/lib/vector/Vlib/hist.c	2013-07-29 08:22:20 UTC (rev 57315)
@@ -63,7 +63,7 @@
     G_debug(5, "Vect_hist_write(): %s", str);
     ret = 0;
     if (Map->hist_fp) {
-	ret = fprintf(Map->hist_fp, str);
+	ret = fprintf(Map->hist_fp, "%s", str);
 	fflush(Map->hist_fp);
     }
 



More information about the grass-commit mailing list