[GRASS-dev] Fwd: [Bug 1037102] grass FTBFS if "-Werror=format-security" flag is used

Markus Neteler neteler at osgeo.org
Mon Aug 11 03:05:31 PDT 2014


Hi,

in Fedora, a new bulk patch got prepared for addressing warnings
triggered by the "-Werror=format-security" flag.
This was discussed last year:
http://lists.osgeo.org/pipermail/grass-dev/2012-August/thread.html#59133

I suppose we should address this issue in our code base. I have
re-generated the diff against relbr64.
While it was decided to not go this way (in most cases) we may re-use
the patch which contains 120 modifications to come up with a better
solution.

Comments welcome,

Markus


---------- Forwarded message ----------
From:  <bugzilla at redhat.com>
Date: Sun, Aug 10, 2014 at 8:30 AM
Subject: [Bug 1037102] grass FTBFS if "-Werror=format-security" flag is used

https://bugzilla.redhat.com/show_bug.cgi?id=1037102

--- Comment #4 from Ralf Corsepius  ---
Created attachment 925470
  --> https://bugzilla.redhat.com/attachment.cgi?id=925470&action=edit
Patch to address -Werror=format-security issues

This is the patch, I had mentioned in
https://bugzilla.redhat.com/show_bug.cgi?id=1106720

It is supposed to fix the issues triggered compiling grass w/
-Werror=format-security.

Due to it's size, I am not expecting it to be bug-free and therefore would
rather see the patch only be applied to rawhide und until some more confidence
has been gained with it.

--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
Index: db/drivers/dbf/column.c
===================================================================
--- db/drivers/dbf/column.c	(revision 61581)
+++ db/drivers/dbf/column.c	(working copy)
@@ -39,7 +39,7 @@
 	sprintf(buf, "DBMI-DBF driver: column name '%s'", name);
 	name[DBF_COL_NAME - 1] = '\0';
 	sprintf(buf + strlen(buf), " truncated to '%s'", name);
-	G_warning(buf);
+	G_warning("%s", buf);
     }
 
     /* Check if the column exists */
Index: display/d.colors/main.c
===================================================================
--- display/d.colors/main.c	(revision 61581)
+++ display/d.colors/main.c	(working copy)
@@ -75,7 +75,7 @@
 	char msg[256];
 
 	sprintf(msg, "Raster file [%s] not available", map->answer);
-	G_fatal_error(msg);
+	G_fatal_error("%s", msg);
     }
 
     if (G_raster_map_is_fp(map->answer, mapset)) {
@@ -82,7 +82,7 @@
 	sprintf(buff,
 		"Raster file [%s] is floating point! \nd.colors only works with integer maps",
 		map->answer);
-	G_fatal_error(buff);
+	G_fatal_error("%s", buff);
     }
 
     /* connect to the driver */
Index: display/d.erase/main.c
===================================================================
--- display/d.erase/main.c	(revision 61581)
+++ display/d.erase/main.c	(working copy)
@@ -79,7 +79,7 @@
 
     R_close_driver();
     if (err)
-	G_fatal_error(err);
+	G_fatal_error("%s", err);
 
     exit(0);
 }
Index: display/d.save/main.c
===================================================================
--- display/d.save/main.c	(revision 61581)
+++ display/d.save/main.c	(working copy)
@@ -454,7 +454,7 @@
 	    G_scan_northing(Nstr, &(Mwind->north), proj);
 	    G_scan_northing(Sstr, &(Mwind->south), proj);
 	    if ((err = G_adjust_Cell_head(Mwind, 1, 1))) {
-		G_fatal_error(err);
+		G_fatal_error("%s", err);
 	    }
 	    G_format_resolution(Mwind->ew_res, EWRESstr, proj);
 	    G_format_resolution(Mwind->ns_res, NSRESstr, proj);
Index: display/d.what.vect/what.c
===================================================================
--- display/d.what.vect/what.c	(revision 61581)
+++ display/d.what.vect/what.c	(working copy)
@@ -494,7 +494,7 @@
 	    fflush(stdout);
 	    if (!txt && !topo) {
 		db_append_string(&html, "</BODY></HTML>");
-		G_debug(3, db_get_string(&html));
+		G_debug(3, "%s", db_get_string(&html));
 		F_open(title, db_get_string(&html));
 	    }
 
Index: general/g.mapset/main.c
===================================================================
--- general/g.mapset/main.c	(revision 61581)
+++ general/g.mapset/main.c	(working copy)
@@ -167,7 +167,7 @@
     G_asprintf(&lock_prog, "%s/etc/lock", G_gisbase());
 
     sprintf(path, "%s/.gislock", mapset_new_path);
-    G_debug(2, path);
+    G_debug(2, "%s", path);
 
     ret = G_spawn(lock_prog, lock_prog, path, gis_lock, NULL);
     G_debug(2, "lock result = %d", ret);
Index: general/g.setproj/get_stp.c
===================================================================
--- general/g.setproj/get_stp.c	(revision 61581)
+++ general/g.setproj/get_stp.c	(working copy)
@@ -56,7 +56,7 @@
     fp = fopen(nad27, "r");
     if (fp == NULL) {
 	sprintf(buff, "Can not open NAD27 file %s", nad27);
-	G_fatal_error(buff);
+	G_fatal_error("%s", buff);
     }
     while (!gotit) {
 	if (fgets(buff, 200, fp) == NULL)
Index: general/g.setproj/main.c
===================================================================
--- general/g.setproj/main.c	(revision 61581)
+++ general/g.setproj/main.c	(working copy)
@@ -250,9 +250,9 @@
 		     0))
 		    sph_check = ask_datum(datum, dat_ellps, dat_params);
 		else {
-		    sprintf(datum, lbuf);
-		    sprintf(dat_params, lbufa);
-		    sprintf(dat_ellps, G_datum_ellipsoid(i));
+		    sprintf(datum, "%s", lbuf);
+		    sprintf(dat_params, "%s", lbufa);
+		    sprintf(dat_ellps, "%s", G_datum_ellipsoid(i));
 		    sph_check = 1;
 		    G_message(_("The datum information has not been changed"));
 		}
Index: imagery/i.landsat.toar/landsat_met.c
===================================================================
--- imagery/i.landsat.toar/landsat_met.c	(revision 61581)
+++ imagery/i.landsat.toar/landsat_met.c	(working copy)
@@ -384,7 +384,7 @@
 	    sprintf(key, "Band%dGainSetting", lsat->band[i].code);
 	    get_mtldata(mtldata, key, value);
 	    if (value[0] == '\0') {
-		G_warning(key);
+		G_warning("%s", key);
 		continue;
 	    }
 	    lsat->band[i].gain = atof(value);
@@ -391,7 +391,7 @@
 	    sprintf(key, "Band%dBiasSetting", lsat->band[i].code);
 	    get_mtldata(mtldata, key, value);
 	    if (value[0] == '\0') {
-		G_warning(key);
+		G_warning("%s", key);
 		continue;
 	    }
 	    lsat->band[i].bias = atof(value);
Index: imagery/i.ortho.photo/i.photo.2image/target.c
===================================================================
--- imagery/i.ortho.photo/i.photo.2image/target.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.2image/target.c	(working copy)
@@ -46,7 +46,7 @@
   error:
     strcat(buf, "Please run i.target for group ");
     strcat(buf, group.name);
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 
     return -1;
 }
Index: imagery/i.ortho.photo/i.photo.2target/target.c
===================================================================
--- imagery/i.ortho.photo/i.photo.2target/target.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.2target/target.c	(working copy)
@@ -81,7 +81,7 @@
     strcat (buf, "Please run i.target for block ");
     strcat (buf, block.name);
 ****/
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 }
 
 int select_current_env(void)
Index: imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c
===================================================================
--- imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c	(working copy)
@@ -81,7 +81,7 @@
 	    strcpy(next, "end");
 	else
 	    sprintf(next, "%d", endfid);
-	sprintf(next_line, next);
+	sprintf(next_line, "%s", next);
 	V_line(line, "                            Next:");
 	V_ques(next, 's', line, 34, 5);
 	V_line(line + 2,
Index: imagery/i.ortho.photo/i.photo.elev/ask_elev.c
===================================================================
--- imagery/i.ortho.photo/i.photo.elev/ask_elev.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.elev/ask_elev.c	(working copy)
@@ -8,7 +8,6 @@
 
 int ask_elev(char *group, char *location, char *mapset)
 {
-    char buf[100];
     char t1[80];
     char t2[80];
 
@@ -35,10 +34,9 @@
 	}
 
 	else if ((mapset_elev = G_find_cell(elev_layer, "")) == NULL) {
-	    sprintf(buf,
+	    G_warning(
 		    "\n\nraster-file %s not found - select another file\n",
 		    elev_layer);
-	    G_warning(buf);
 	    *elev_layer = 0;
 	    continue;
 	}
Index: imagery/i.ortho.photo/i.photo.elev/main.c
===================================================================
--- imagery/i.ortho.photo/i.photo.elev/main.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.elev/main.c	(working copy)
@@ -131,7 +131,7 @@
     strcat(buf, _("Please select a target for group"));
     strcat(buf, group);
     G_suppress_warnings(0);
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 }
 
 
Index: imagery/i.ortho.photo/i.photo.rectify/cp.c
===================================================================
--- imagery/i.ortho.photo/i.photo.rectify/cp.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.rectify/cp.c	(working copy)
@@ -31,7 +31,7 @@
     default:
 	return 1;
     }
-    G_fatal_error(msg);
+    G_fatal_error("%s", msg);
 }
 
 int get_ref_points(void)
@@ -61,6 +61,6 @@
     default:
 	return 1;
     }
-    G_fatal_error(msg);
+    G_fatal_error("%s", msg);
     /* exit(1);   shouldn't get here */
 }
Index: imagery/i.ortho.photo/i.photo.rectify/target.c
===================================================================
--- imagery/i.ortho.photo/i.photo.rectify/target.c	(revision 61581)
+++ imagery/i.ortho.photo/i.photo.rectify/target.c	(working copy)
@@ -31,5 +31,5 @@
     sprintf(buf, _("Mapset <%s> in target location <%s> - "), mapset, location);
     strcat(buf, stat == 0 ? _("permission denied") : _("not found"));
   error:
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 }
Index: imagery/i.ortho.photo/libes/camera.c
===================================================================
--- imagery/i.ortho.photo/libes/camera.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/camera.c	(working copy)
@@ -33,10 +33,9 @@
     fd = I_fopen_group_camera_old(group);
     G_suppress_warnings(0);
     if (!fd) {
-	sprintf(buf,
+	G_warning(
 		_("Unable to open camera file for group <%s> in mapset <%s>"),
 		group, G_mapset());
-	G_warning(buf);
 	return 0;
     }
     G_getl2(buf, sizeof(buf), fd);
Index: imagery/i.ortho.photo/libes/conz_points.c
===================================================================
--- imagery/i.ortho.photo/libes/conz_points.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/conz_points.c	(working copy)
@@ -96,15 +96,13 @@
 int I_get_con_points(char *group, struct Ortho_Control_Points *cp)
 {
     FILE *fd;
-    char msg[100];
     int stat;
 
     fd = I_fopen_group_file_old(group, POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg,
+	G_warning(
 		"unable to open control point (Z) file for group [%s in %s]",
 		group, G_mapset());
-	G_warning(msg);
 	G_sleep(4);
 	return 0;
     }
@@ -112,9 +110,8 @@
     stat = I_read_con_points(fd, cp);
     fclose(fd);
     if (stat < 0) {
-	sprintf(msg, "bad format in control point file for group [%s in %s]",
+	G_warning("bad format in control point file for group [%s in %s]",
 		group, G_mapset());
-	G_warning(msg);
 	G_sleep(4);
 	return 0;
     }
@@ -124,14 +121,12 @@
 int I_put_con_points(char *group, struct Ortho_Control_Points *cp)
 {
     FILE *fd;
-    char msg[100];
 
     fd = I_fopen_group_file_new(group, POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg,
+	G_warning(
 		"unable to create control point file for group [%s in %s]",
 		group, G_mapset());
-	G_warning(msg);
 	G_sleep(4);
 	return 0;
     }
@@ -146,7 +141,6 @@
 			 double N12[3])
 {
     FILE *fd;
-    char msg[100];
     int i, stat, status;
     double e1, e2, n1, n2, z1, z2, e0, n0;
 
@@ -153,10 +147,9 @@
 
     fd = I_fopen_group_file_old(group, POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg,
+	G_warning(
 		"unable to open control point (Z) file for group [%s in %s]",
 		group, G_mapset());
-	G_warning(msg);
 	G_sleep(4);
 	return 0;
     }
@@ -164,9 +157,8 @@
     stat = I_read_con_points(fd, con_cp);
     fclose(fd);
     if (stat < 0) {
-	sprintf(msg, "bad format in control point file for group [%s in %s]",
+	G_warning("bad format in control point file for group [%s in %s]",
 		group, G_mapset());
-	G_warning(msg);
 	G_sleep(4);
 	return 0;
     }
Index: imagery/i.ortho.photo/libes/fopen_camera.c
===================================================================
--- imagery/i.ortho.photo/libes/fopen_camera.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/fopen_camera.c	(working copy)
@@ -54,11 +54,8 @@
 
 static int error(char *camera, char *msga, char *msgb)
 {
-    char buf[100];
-
-    sprintf(buf, "%s camera file [%s] in [%s %s] %s",
+    G_warning("%s camera file [%s] in [%s %s] %s",
 	    msga, camera, G_location(), G_mapset(), msgb);
-    G_warning(buf);
 
     return 0;
 }
Index: imagery/i.ortho.photo/libes/init_info.c
===================================================================
--- imagery/i.ortho.photo/libes/init_info.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/init_info.c	(working copy)
@@ -94,14 +94,12 @@
 int I_get_init_info(char *group, struct Ortho_Camera_Exp_Init *init_info)
 {
     FILE *fd;
-    char msg[100];
     int stat;
 
     fd = I_fopen_group_init_old(group);
     if (fd == NULL) {
-	sprintf(msg, "unable to open camera initial file %s in %s",
+	G_warning("unable to open camera initial file %s in %s",
 		group, G_mapset());
-	G_warning(msg);
 	return 0;
     }
 
@@ -108,9 +106,8 @@
     stat = I_read_init_info(fd, init_info);
     fclose(fd);
     if (stat < 0) {
-	sprintf(msg, "bad format in camera initial file %s in %s",
+	G_warning("bad format in camera initial file %s in %s",
 		group, G_mapset());
-	G_warning(msg);
 	return 0;
     }
     return 1;
@@ -119,13 +116,11 @@
 int I_put_init_info(char *group, struct Ortho_Camera_Exp_Init *init_info)
 {
     FILE *fd;
-    char msg[100];
 
     fd = I_fopen_group_init_new(group);
     if (fd == NULL) {
-	sprintf(msg, "unable to open camera initial file %s in %s",
+	G_warning("unable to open camera initial file %s in %s",
 		group, G_mapset());
-	G_warning(msg);
 	return 0;
     }
 
Index: imagery/i.ortho.photo/libes/m_mult.c
===================================================================
--- imagery/i.ortho.photo/libes/m_mult.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/m_mult.c	(working copy)
@@ -21,7 +21,7 @@
     if (a->ncols != b->nrows) {
 	sprintf(message, "*: matrices not conformable, %d x %d * %d x %d\n",
 		a->nrows, a->ncols, b->nrows, b->ncols);
-	fprintf(stderr, message);
+	fprintf(stderr, "%s", message);
 	return error(message);
     }
 
Index: imagery/i.ortho.photo/libes/open_camera.c
===================================================================
--- imagery/i.ortho.photo/libes/open_camera.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/open_camera.c	(working copy)
@@ -46,11 +46,8 @@
 
 static int camera_error(char *camera, char *file, char *msga, char *msgb)
 {
-    char buf[100];
-
-    sprintf(buf, "%sfile [%s] of group [%s in %s]%s",
+    G_warning("%sfile [%s] of group [%s in %s]%s",
 	    msga, file, camera, G_mapset(), msgb);
-    G_warning(buf);
 
     return 0;
 }
Index: imagery/i.ortho.photo/libes/ref_points.c
===================================================================
--- imagery/i.ortho.photo/libes/ref_points.c	(revision 61581)
+++ imagery/i.ortho.photo/libes/ref_points.c	(working copy)
@@ -88,16 +88,14 @@
 int I_get_ref_points(char *groupname, struct Ortho_Photo_Points *cp)
 {
     FILE *fd;
-    char msg[100];
     int stat;
 
     /*fprintf (stderr, "Try to f_open_group_file_old \n"); */
     fd = I_fopen_group_file_old(groupname, REF_POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg,
+	G_warning(
 		"unable to open reference point file for group [%s in %s]",
 		groupname, G_mapset());
-	G_warning(msg);
 	return 0;
     }
 
@@ -105,10 +103,9 @@
     stat = I_read_ref_points(fd, cp);
     fclose(fd);
     if (stat < 0) {
-	sprintf(msg,
+	G_warning(
 		"bad format in reference point file for group [%s in %s]",
 		groupname, G_mapset());
-	G_warning(msg);
 	return 0;
     }
     return 1;
@@ -117,14 +114,12 @@
 int I_put_ref_points(char *groupname, struct Ortho_Photo_Points *cp)
 {
     FILE *fd;
-    char msg[100];
 
     fd = I_fopen_group_file_new(groupname, REF_POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg,
+	G_warning(
 		"unable to create reference point file for group [%s in %s]",
 		groupname, G_mapset());
-	G_warning(msg);
 	return 0;
     }
 
Index: imagery/i.ortho.photo/menu/target.c
===================================================================
--- imagery/i.ortho.photo/menu/target.c	(revision 61581)
+++ imagery/i.ortho.photo/menu/target.c	(working copy)
@@ -34,5 +34,5 @@
     sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
     strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
   error:
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 }
Index: imagery/i.pca/support.c
===================================================================
--- imagery/i.pca/support.c	(revision 61581)
+++ imagery/i.pca/support.c	(working copy)
@@ -63,7 +63,8 @@
 	sprintf(tmpa, "[%5.2f%%]", eigval[i] * 100/eigval_total);
 	strcat(tmpeigen, tmpa);
 
-	sprintf(hist.edhist[i + 1], tmpeigen);
+//	sprintf(hist.edhist[i + 1], tmpeigen);
+        strcpy(hist.edhist[i + 1], tmpeigen);
 
 	/* write eigen values to stdout */
 	if (first_map)
Index: imagery/i.points/target.c
===================================================================
--- imagery/i.points/target.c	(revision 61581)
+++ imagery/i.points/target.c	(working copy)
@@ -40,7 +40,7 @@
   error:
     strcat(buf, "Please run i.target for group ");
     strcat(buf, group.name);
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 }
 
 int select_current_env(void)
Index: imagery/i.rectify/cp.c
===================================================================
--- imagery/i.rectify/cp.c	(revision 61581)
+++ imagery/i.rectify/cp.c	(working copy)
@@ -40,7 +40,7 @@
 	 */
 	return 1;
     }
-    G_fatal_error(msg);
+    G_fatal_error("%s", msg);
 
     return 0; /* G_fatal_error() calls exit() */
 }
Index: imagery/i.rectify/target.c
===================================================================
--- imagery/i.rectify/target.c	(revision 61581)
+++ imagery/i.rectify/target.c	(working copy)
@@ -34,6 +34,6 @@
   error:
     strcat(buf, _("Please run i.target for group."));
     strcat(buf, group);
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
     return 1;			/* never reached */
 }
Index: imagery/i.vpoints/analyze.c
===================================================================
--- imagery/i.vpoints/analyze.c	(revision 61581)
+++ imagery/i.vpoints/analyze.c	(working copy)
@@ -116,11 +116,9 @@
 int delete_control_point(int n)
 {
     int i;
-    char msg[80];
 
     if ((n < 0) | (n > group.points.count - 1)) {
-	sprintf(msg, "%d is an invalid control point index value.", n);
-	G_warning(msg);
+	G_warning("%d is an invalid control point index value.", n);
 	return 1;
     }
     for (i = n; i < group.points.count - 1; i++) {
Index: imagery/i.vpoints/target.c
===================================================================
--- imagery/i.vpoints/target.c	(revision 61581)
+++ imagery/i.vpoints/target.c	(working copy)
@@ -41,7 +41,7 @@
   error:
     strcat(buf, "Please run i.target for group ");
     strcat(buf, group.name);
-    G_fatal_error(buf);
+    G_fatal_error("%s", buf);
 
     return -1;
 }
Index: lib/db/dbmi_base/login.c
===================================================================
--- lib/db/dbmi_base/login.c	(revision 61581)
+++ lib/db/dbmi_base/login.c	(working copy)
@@ -95,7 +95,7 @@
 		ret, dr, db, usr, pwd);
 
 	if (ret < 2) {
-	    G_warning(_("Login file corrupted"));
+	    G_warning("%s", _("Login file corrupted"));
 	    continue;
 	}
 
Index: lib/db/dbmi_client/delete_tab.c
===================================================================
--- lib/db/dbmi_client/delete_tab.c	(revision 61581)
+++ lib/db/dbmi_client/delete_tab.c	(working copy)
@@ -47,7 +47,7 @@
     db_init_string(&sql);
     db_set_string(&sql, "drop table ");
     db_append_string(&sql, tblname);
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	G_warning(_("Unable to drop table: '%s'"),
Index: lib/driver/command.c
===================================================================
--- lib/driver/command.c	(revision 61581)
+++ lib/driver/command.c	(working copy)
@@ -544,7 +544,7 @@
 	    continue;
 	while (*c == COMMAND_ESC)
 	    if (read1(c) != 0) {
-		G_warning(_("Monitor: get_command: Premature EOF"));
+		G_warning("%s", _("Monitor: get_command: Premature EOF"));
 		return 1;	/* EOF */
 	    }
 	if (*c)
Index: lib/g3d/g3derror.c
===================================================================
--- lib/g3d/g3derror.c	(revision 61581)
+++ lib/g3d/g3derror.c	(working copy)
@@ -40,7 +40,7 @@
 void G3d_printError(const char *msg)
 {
     fprintf(stderr, "ERROR: ");
-    fprintf(stderr, msg);
+    fprintf(stderr, "%s", msg);
     fprintf(stderr, "\n");
 }
 
Index: lib/g3d/g3drange.c
===================================================================
--- lib/g3d/g3drange.c	(revision 61581)
+++ lib/g3d/g3drange.c	(working copy)
@@ -196,8 +196,7 @@
 
   error:
     G_remove(buf, buf2);	/* remove the old file with this name */
-    sprintf(buf, "can't write range file for [%s in %s]", name, G_mapset());
-    G_warning(buf);
+    G_warning("can't write range file for [%s in %s]", name, G_mapset());
     return -1;
 }
 
Index: lib/g3d/g3dwindowio.c
===================================================================
--- lib/g3d/g3dwindowio.c	(revision 61581)
+++ lib/g3d/g3dwindowio.c	(working copy)
@@ -71,7 +71,7 @@
 	windowName++;
 
     if (strchr(windowName, GRASS_DIRSEP) || strchr(windowName, HOST_DIRSEP)) {
-	sprintf(path, windowName);
+	sprintf(path, "%s", windowName);
 	return;
     }
 
Index: lib/gis/get_cellhd.c
===================================================================
--- lib/gis/get_cellhd.c	(revision 61581)
+++ lib/gis/get_cellhd.c	(working copy)
@@ -78,7 +78,7 @@
 		sprintf(tail, _("which is missing."));
 	    else
 		sprintf(tail, _("whose header file can't be opened."));
-	    G_warning(buf);
+	    G_warning("%s", buf);
 	    return -1;
 	}
     }
@@ -112,6 +112,6 @@
 
     G_free(err);
 
-    G_warning(buf);
+    G_warning("%s", buf);
     return -1;
 }
Index: lib/gis/get_datum_name.c
===================================================================
--- lib/gis/get_datum_name.c	(revision 61581)
+++ lib/gis/get_datum_name.c	(working copy)
@@ -106,15 +106,15 @@
 	/* For a custom datum we need to interactively ask for the ellipsoid */
 	if (G_ask_ellipse_name(ellipse) < 0)
 	    return -1;
-	sprintf(ellpsname, ellipse);
-	sprintf(datumname, "custom");
+	strcpy(ellpsname, ellipse);
+	strcpy(datumname, "custom");
     }
     else {
 	/* else can look it up from datum.table */
 	if ((i = G_get_datum_by_name(answer)) < 0)
 	    return -1;
-	sprintf(ellpsname, G_datum_ellipsoid(i));
-	sprintf(datumname, G_datum_name(i));
+	strcpy(ellpsname, G_datum_ellipsoid(i));
+	strcpy(datumname, G_datum_name(i));
     }
 
     return 1;
Index: lib/gis/get_ellipse.c
===================================================================
--- lib/gis/get_ellipse.c	(revision 61581)
+++ lib/gis/get_ellipse.c	(working copy)
@@ -281,7 +281,7 @@
     if (fd == NULL) {
 	perror(file);
 	sprintf(buf, _("Unable to open ellipsoid table file <%s>"), file);
-	fatal ? G_fatal_error(buf) : G_warning(buf);
+	fatal ? G_fatal_error("%s", buf) : G_warning("%s", buf);
 	return 0;
     }
 
Index: lib/gis/history.c
===================================================================
--- lib/gis/history.c	(revision 61581)
+++ lib/gis/history.c	(working copy)
@@ -270,7 +270,8 @@
     }
 
     if (cmdlen < 70) {		/* ie if it will fit on a single line */
-	sprintf(hist->edhist[hist->edlinecnt], G_recreate_command());
+//	sprintf(hist->edhist[hist->edlinecnt], G_recreate_command());
+        strcpy(hist->edhist[hist->edlinecnt], G_recreate_command());
 	hist->edlinecnt++;
     }
     else {			/* multi-line required */
Index: lib/gis/null_val.c
===================================================================
--- lib/gis/null_val.c	(revision 61581)
+++ lib/gis/null_val.c	(working copy)
@@ -112,7 +112,7 @@
     strcpy(errMsg, _("Null values have not been initialized. "));
     strcat(errMsg, _("G_gisinit() must be called first. "));
     strcat(errMsg, _("Please advise GRASS developers of this error.\n"));
-    G_fatal_error(errMsg);
+    G_fatal_error("%s", errMsg);
 
     return;
 }
Index: lib/gis/put_cellhd.c
===================================================================
--- lib/gis/put_cellhd.c	(revision 61581)
+++ lib/gis/put_cellhd.c	(working copy)
@@ -21,10 +21,7 @@
     FILE *fd;
 
     if (!(fd = G_fopen_new("cellhd", name))) {
-	char buf[1024];
-
-	sprintf(buf, _("Unable to create header file for [%s]"), name);
-	G_warning(buf);
+	G_warning(_("Unable to create header file for [%s]"), name);
 	return -1;
     }
 
Index: lib/gis/put_title.c
===================================================================
--- lib/gis/put_title.c	(revision 61581)
+++ lib/gis/put_title.c	(working copy)
@@ -25,10 +25,8 @@
     in = out = 0;
     in = G_fopen_old("cats", name, mapset);
     if (!in) {
-	sprintf(buf,
-		_("category information for [%s] in [%s] missing or invalid"),
+	G_warning(_("category information for [%s] in [%s] missing or invalid"),
 		name, mapset);
-	G_warning(buf);
 	return -1;
     }
 
@@ -36,8 +34,7 @@
     out = fopen(tempfile, "w");
     if (!out) {
 	fclose(in);
-	sprintf(buf, _("G_put_title - can't create a temp file"));
-	G_warning(buf);
+	G_warning(_("G_put_title - can't create a temp file"));
 	return -1;
     }
 
@@ -53,16 +50,14 @@
 
     /* must be #cats line, title line, and label for cat 0 */
     if (line < 3) {
-	sprintf(buf, _("category information for [%s] in [%s] invalid"), name,
+	G_warning(_("category information for [%s] in [%s] invalid"), name,
 		mapset);
-	G_warning(buf);
 	return -1;
     }
 
     in = fopen(tempfile, "r");
     if (!in) {
-	sprintf(buf, _("G_put_title - can't reopen temp file"));
-	G_warning(buf);
+	G_warning(_("G_put_title - can't reopen temp file"));
 	return -1;
     }
 
@@ -69,9 +64,8 @@
     out = G_fopen_new("cats", name);
     if (!out) {
 	fclose(in);
-	sprintf(buf, _("can't write category information for [%s] in [%s]"),
+	G_warning(_("can't write category information for [%s] in [%s]"),
 		name, mapset);
-	G_warning(buf);
 	return -1;
     }
 
Index: lib/gis/quant_io.c
===================================================================
--- lib/gis/quant_io.c	(revision 61581)
+++ lib/gis/quant_io.c	(working copy)
@@ -121,10 +121,9 @@
     G_quant_free(quant);
 
     if (G_raster_map_type(name, mapset) == CELL_TYPE) {
-	sprintf(buf,
+	G_warning(
 		"G__quant_import: attempt to open quantization table for CELL_TYPE file [%s] in mapset {%s]",
 		name, mapset);
-	G_warning(buf);
 	return -2;
     }
 
@@ -164,9 +163,8 @@
 	err = "empty";
     }
 
-    sprintf(buf,
+    G_warning(
 	    _("quantization file [%s] in mapset [%s] %s"), name, mapset, err);
-    G_warning(buf);
 
     return 0;
 }
Index: lib/gis/quant_rw.c
===================================================================
--- lib/gis/quant_rw.c	(revision 61581)
+++ lib/gis/quant_rw.c	(working copy)
@@ -63,7 +63,6 @@
 
 int G_truncate_fp_map(const char *name, const char *mapset)
 {
-    char buf[300];
     struct Quant quant;
 
     G_quant_init(&quant);
@@ -70,9 +69,8 @@
     G_quant_truncate(&quant);
     /* quantize the map */
     if (G_write_quant(name, mapset, &quant) < 0) {
-	sprintf(buf, "G_truncate_fp_map: can't write quant rules for map %s",
+	G_warning("G_truncate_fp_map: can't write quant rules for map %s",
 		name);
-	G_warning(buf);
 	return -1;
     }
     return 1;
@@ -80,7 +78,6 @@
 
 int G_round_fp_map(const char *name, const char *mapset)
 {
-    char buf[300];
     struct Quant quant;
 
     G_quant_init(&quant);
@@ -87,9 +84,8 @@
     G_quant_round(&quant);
     /* round the map */
     if (G_write_quant(name, mapset, &quant) < 0) {
-	sprintf(buf, "G_truncate_fp_map: can't write quant rules for map %s",
+	G_warning("G_truncate_fp_map: can't write quant rules for map %s",
 		name);
-	G_warning(buf);
 	return -1;
     }
     return 1;
@@ -113,20 +109,17 @@
 int G_quantize_fp_map(const char *name, const char *mapset,
 		      CELL min, CELL max)
 {
-    char buf[300];
     DCELL d_min, d_max;
     struct FPRange fp_range;
 
     if (G_read_fp_range(name, mapset, &fp_range) < 0) {
-	sprintf(buf, "G_quantize_fp_map: can't read fp range for map %s",
+	G_warning("G_quantize_fp_map: can't read fp range for map %s",
 		name);
-	G_warning(buf);
 	return -1;
     }
     G_get_fp_range_min_max(&fp_range, &d_min, &d_max);
     if (G_is_d_null_value(&d_min) || G_is_d_null_value(&d_max)) {
-	sprintf(buf, "G_quantize_fp_map: raster map %s is empty", name);
-	G_warning(buf);
+	G_warning("G_quantize_fp_map: raster map %s is empty", name);
 	return -1;
     }
     return G_quantize_fp_map_range(name, mapset, d_min, d_max, min, max);
@@ -159,7 +152,6 @@
 int G_quantize_fp_map_range(const char *name, const char *mapset,
 			    DCELL d_min, DCELL d_max, CELL min, CELL max)
 {
-    char buf[300];
     struct Quant quant;
 
     G_quant_init(&quant);
@@ -166,10 +158,9 @@
     G_quant_add_rule(&quant, d_min, d_max, min, max);
     /* quantize the map */
     if (G_write_quant(name, mapset, &quant) < 0) {
-	sprintf(buf,
+	G_warning(
 		"G_quantize_fp_map_range: can't write quant rules for map %s",
 		name);
-	G_warning(buf);
 	return -1;
     }
     return 1;
@@ -200,11 +191,9 @@
 {
     CELL cell_min, cell_max;
     DCELL d_min, d_max;
-    char buf[300];
 
     if (G_raster_map_type(name, mapset) == CELL_TYPE) {
-	sprintf(buf, _("Cannot write quant rules: map %s is integer"), name);
-	G_warning(buf);
+	G_warning(_("Cannot write quant rules: map %s is integer"), name);
 	return -1;
     }
 
@@ -212,8 +201,7 @@
 
     /* first actually write the rules */
     if (G__quant_export(name, mapset, quant) < 0) {
-	sprintf(buf, _("Cannot write quant rules for map %s"), name);
-	G_warning(buf);
+	G_warning(_("Cannot write quant rules for map %s"), name);
 	return -1;
     }
 
Index: lib/gis/range.c
===================================================================
--- lib/gis/range.c	(revision 61581)
+++ lib/gis/range.c	(working copy)
@@ -189,8 +189,7 @@
   error:
     if (fd > 0)
 	close(fd);
-    sprintf(buf, _("can't read f_range file for [%s in %s]"), name, mapset);
-    G_warning(buf);
+    G_warning(buf, _("can't read f_range file for [%s in %s]"), name, mapset);
     return -1;
 }
 
@@ -240,10 +239,9 @@
 	DCELL dmin, dmax;
 
 	if (G_read_quant(name, mapset, &quant) < 0) {
-	    sprintf(buf,
+	    G_warning(buf,
 		    "G_read_range(): can't read quant rules for fp map %s@%s",
 		    name, mapset);
-	    G_warning(buf);
 	    return -1;
 	}
 	if (G_quant_is_truncate(&quant) || G_quant_is_round(&quant)) {
@@ -305,8 +303,7 @@
   error:
     if (fd)
 	fclose(fd);
-    sprintf(buf, _("can't read range file for [%s in %s]"), name, mapset);
-    G_warning(buf);
+    G_warning(_("can't read range file for [%s in %s]"), name, mapset);
     return -1;
 }
 
@@ -356,9 +353,8 @@
 
   error:
     G_remove_misc("cell_misc", "range", name);	/* remove the old file with this name */
-    sprintf(buf, _("can't write range file for [%s in %s]"),
+    G_warning(_("can't write range file for [%s in %s]"),
 	    name, G_mapset());
-    G_warning(buf);
     return -1;
 }
 
@@ -409,9 +405,8 @@
 
   error:
     G_remove(buf, "f_range");	/* remove the old file with this name */
-    sprintf(buf, _("can't write range file for [%s in %s]"),
+    G_warning(_("can't write range file for [%s in %s]"),
 	    name, G_mapset());
-    G_warning(buf);
     return -1;
 }
 
Index: lib/gis/seek.c
===================================================================
--- lib/gis/seek.c	(revision 61581)
+++ lib/gis/seek.c	(working copy)
@@ -49,12 +49,12 @@
 {
 #ifdef HAVE_FSEEKO
     if (fseeko(fp, offset, whence) != 0)
-	G_fatal_error(_("Unable to seek"));
+	G_fatal_error("%s", _("Unable to seek"));
 #else
     long loff = (long) offset;
     if ((off_t) loff != offset)
-	G_fatal_error(_("Seek offset out of range"));
+	G_fatal_error("%s", _("Seek offset out of range"));
     if (fseek(fp, loff, whence) != 0)
-	G_fatal_error(_("Unable to seek"));
+	G_fatal_error("%s", _("Unable to seek"));
 #endif     
 }
Index: lib/gmath/la.c
===================================================================
--- lib/gmath/la.c	(revision 61581)
+++ lib/gmath/la.c	(working copy)
@@ -57,7 +57,7 @@
     mat_struct *tmp_arry;
 
     if (rows < 1 || cols < 1 || ldim < rows) {
-	G_warning(_("Matrix dimensions out of range"));
+	G_warning("%s", _("Matrix dimensions out of range"));
 	return NULL;
     }
 
@@ -113,7 +113,7 @@
 int G_matrix_set(mat_struct * A, int rows, int cols, int ldim)
 {
     if (rows < 1 || cols < 1 || ldim < 0) {
-	G_warning(_("Matrix dimensions out of range"));
+	G_warning("%s", _("Matrix dimensions out of range"));
 	return -1;
     }
 
@@ -146,12 +146,12 @@
     mat_struct *B;
 
     if (!A->is_init) {
-	G_warning(_("Matrix is not initialised fully."));
+	G_warning("%s", _("Matrix is not initialised fully."));
 	return NULL;
     }
 
     if ((B = G_matrix_init(A->rows, A->cols, A->ldim)) == NULL) {
-	G_warning(_("Unable to allocate space for matrix copy"));
+	G_warning("%s", _("Unable to allocate space for matrix copy"));
 	return NULL;
     }
 
@@ -240,13 +240,13 @@
     int i, j;			/* loop variables */
 
     if (c1 == 0) {
-	G_warning(_("First scalar multiplier must be non-zero"));
+	G_warning("%s", _("First scalar multiplier must be non-zero"));
 	return NULL;
     }
 
     if (c2 == 0) {
 	if (!mt1->is_init) {
-	    G_warning(_("One or both input matrices uninitialised"));
+	    G_warning("%s", _("One or both input matrices uninitialised"));
 	    return NULL;
 	}
     }
@@ -254,18 +254,18 @@
     else {
 
 	if (!((mt1->is_init) && (mt2->is_init))) {
-	    G_warning(_("One or both input matrices uninitialised"));
+	    G_warning("%s", _("One or both input matrices uninitialised"));
 	    return NULL;
 	}
 
 	if (mt1->rows != mt2->rows || mt1->cols != mt2->cols) {
-	    G_warning(_("Matrix order does not match"));
+	    G_warning("%s", _("Matrix order does not match"));
 	    return NULL;
 	}
     }
 
     if ((mt3 = G_matrix_init(mt1->rows, mt1->cols, mt1->ldim)) == NULL) {
-	G_warning(_("Unable to allocate space for matrix sum"));
+	G_warning("%s", _("Unable to allocate space for matrix sum"));
 	return NULL;
     }
 
@@ -319,17 +319,17 @@
     integer1 no_trans = 'n';
 
     if (!((mt1->is_init) || (mt2->is_init))) {
-	G_warning(_("One or both input matrices uninitialised"));
+	G_warning("%s", _("One or both input matrices uninitialised"));
 	return NULL;
     }
 
     if (mt1->cols != mt2->rows) {
-	G_warning(_("Matrix order does not match"));
+	G_warning("%s", _("Matrix order does not match"));
 	return NULL;
     }
 
     if ((mt3 = G_matrix_init(mt1->rows, mt2->cols, mt1->ldim)) == NULL) {
-	G_warning(_("Unable to allocate space for matrix product"));
+	G_warning("%s", _("Unable to allocate space for matrix product"));
 	return NULL;
     }
 
@@ -441,29 +441,29 @@
     mat_struct *wmat, *xmat, *mtx;
 
     if (mt1->is_init == 0 || bmat->is_init == 0) {
-	G_warning(_("Input: one or both data matrices uninitialised"));
+	G_warning("%s", _("Input: one or both data matrices uninitialised"));
 	return -1;
     }
 
     if (mt1->rows != mt1->cols || mt1->rows < 1) {
-	G_warning(_("Principal matrix is not properly dimensioned"));
+	G_warning("%s", _("Principal matrix is not properly dimensioned"));
 	return -1;
     }
 
     if (bmat->cols < 1) {
-	G_warning(_("Input: you must have at least one array to solve"));
+	G_warning("%s", _("Input: you must have at least one array to solve"));
 	return -1;
     }
 
     /* Now create solution matrix by copying the original coefficient matrix */
     if ((xmat = G_matrix_copy(bmat)) == NULL) {
-	G_warning(_("Could not allocate space for solution matrix"));
+	G_warning("%s", _("Could not allocate space for solution matrix"));
 	return -1;
     }
 
     /* Create working matrix for the coefficient array */
     if ((mtx = G_matrix_copy(mt1)) == NULL) {
-	G_warning(_("Could not allocate space for working matrix"));
+	G_warning("%s", _("Could not allocate space for working matrix"));
 	return -1;
     }
 
@@ -471,7 +471,7 @@
        original information 
      */
     if ((wmat = G_matrix_copy(bmat)) == NULL) {
-	G_warning(_("Could not allocate space for working matrix"));
+	G_warning("%s", _("Could not allocate space for working matrix"));
 	return -1;
     }
 
@@ -524,11 +524,11 @@
 	    G_matrix_free(mtx);
 
 	    if (res_info > 0) {
-		G_warning(_("Matrix (or submatrix is singular). Solution undetermined"));
+		G_warning("%s", _("Matrix (or submatrix is singular). Solution undetermined"));
 		return 1;
 	    }
 	    else if (res_info < 0) {
-		G_warning(_("Problem in LA routine."));
+		G_warning("%s", _("Problem in LA routine."));
 		return -1;
 	    }
 	    break;
@@ -535,7 +535,7 @@
 	}
     default:
 	{
-	    G_warning(_("Procedure not yet available for selected matrix type"));
+	    G_warning("%s", _("Procedure not yet available for selected matrix type"));
 	    return -1;
 	}
     }				/* end switch */
@@ -569,12 +569,12 @@
     int i, j, k;		/* loop */
 
     if (mt->rows != mt->cols) {
-	G_warning(_("Matrix is not square. Cannot determine inverse"));
+	G_warning("%s", _("Matrix is not square. Cannot determine inverse"));
 	return NULL;
     }
 
     if ((mt0 = G_matrix_init(mt->rows, mt->rows, mt->ldim)) == NULL) {
-	G_warning(_("Unable to allocate space for matrix"));
+	G_warning("%s", _("Unable to allocate space for matrix"));
 	return NULL;
     }
 
@@ -591,12 +591,12 @@
 
     /* Solve system */
     if ((k = G_matrix_LU_solve(mt, &res, mt0, NONSYM)) == 1) {
-	G_warning(_("Matrix is singular"));
+	G_warning("%s", _("Matrix is singular"));
 	G_matrix_free(mt0);
 	return NULL;
     }
     else if (k < 0) {
-	G_warning(_("Problem in LA procedure."));
+	G_warning("%s", _("Problem in LA procedure."));
 	G_matrix_free(mt0);
 	return NULL;
     }
@@ -684,12 +684,12 @@
 int G_matrix_set_element(mat_struct * mt, int rowval, int colval, double val)
 {
     if (!mt->is_init) {
-	G_warning(_("Element array has not been allocated"));
+	G_warning("%s", _("Element array has not been allocated"));
 	return -1;
     }
 
     if (rowval >= mt->rows || colval >= mt->cols || rowval < 0 || colval < 0) {
-	G_warning(_("Specified element is outside array bounds"));
+	G_warning("%s", _("Specified element is outside array bounds"));
 	return -1;
     }
 
@@ -743,17 +743,17 @@
     vec_struct *vc1;
 
     if (col < 0 || col >= mt->cols) {
-	G_warning(_("Specified matrix column index is outside range"));
+	G_warning("%s", _("Specified matrix column index is outside range"));
 	return NULL;
     }
 
     if (!mt->is_init) {
-	G_warning(_("Matrix is not initialised"));
+	G_warning("%s", _("Matrix is not initialised"));
 	return NULL;
     }
 
     if ((vc1 = G_vector_init(mt->rows, mt->ldim, CVEC)) == NULL) {
-	G_warning(_("Could not allocate space for vector structure"));
+	G_warning("%s", _("Could not allocate space for vector structure"));
 	return NULL;
     }
 
@@ -784,17 +784,17 @@
     vec_struct *vc1;
 
     if (row < 0 || row >= mt->cols) {
-	G_warning(_("Specified matrix row index is outside range"));
+	G_warning("%s", _("Specified matrix row index is outside range"));
 	return NULL;
     }
 
     if (!mt->is_init) {
-	G_warning(_("Matrix is not initialised"));
+	G_warning("%s", _("Matrix is not initialised"));
 	return NULL;
     }
 
     if ((vc1 = G_vector_init(mt->cols, mt->ldim, RVEC)) == NULL) {
-	G_warning(_("Could not allocate space for vector structure"));
+	G_warning("%s", _("Could not allocate space for vector structure"));
 	return NULL;
     }
 
@@ -824,12 +824,12 @@
 int G_matvect_extract_vector(mat_struct * mt, vtype vt, int indx)
 {
     if (vt == RVEC && indx >= mt->rows) {
-	G_warning(_("Specified row index is outside range"));
+	G_warning("%s", _("Specified row index is outside range"));
 	return -1;
     }
 
     else if (vt == CVEC && indx >= mt->cols) {
-	G_warning(_("Specified column index is outside range"));
+	G_warning("%s", _("Specified column index is outside range"));
 	return -1;
     }
 
@@ -849,7 +849,7 @@
 
     default:
 	{
-	    G_warning(_("Unknown vector type."));
+	    G_warning("%s", _("Unknown vector type."));
 	    return -1;
 	}
 
@@ -974,34 +974,34 @@
     int i;
 
     if (!out->is_init) {
-	G_warning(_("Output vector is uninitialized"));
+	G_warning("%s", _("Output vector is uninitialized"));
 	return NULL;
     }
 
     if (v1->type != v2->type) {
-	G_warning(_("Vectors are not of the same type"));
+	G_warning("%s", _("Vectors are not of the same type"));
 	return NULL;
     }
 
     if (v1->type != out->type) {
-	G_warning(_("Output vector is of incorrect type"));
+	G_warning("%s", _("Output vector is of incorrect type"));
 	return NULL;
     }
 
     if (v1->type == MATRIX_) {
-	G_warning(_("Matrices not allowed"));
+	G_warning("%s", _("Matrices not allowed"));
 	return NULL;
     }
 
     if ((v1->type == ROWVEC_ && v1->cols != v2->cols) ||
 	(v1->type == COLVEC_ && v1->rows != v2->rows)) {
-	G_warning(_("Vectors have differing dimensions"));
+	G_warning("%s", _("Vectors have differing dimensions"));
 	return NULL;
     }
 
     if ((v1->type == ROWVEC_ && v1->cols != out->cols) ||
 	(v1->type == COLVEC_ && v1->rows != out->rows)) {
-	G_warning(_("Output vector has incorrect dimension"));
+	G_warning("%s", _("Output vector has incorrect dimension"));
 	return NULL;
     }
 
@@ -1047,12 +1047,12 @@
 {
     if ((cells < 1) || (vt == RVEC && ldim < 1)
 	|| (vt == CVEC && ldim < cells) || ldim < 0) {
-	G_warning(_("Vector dimensions out of range"));
+	G_warning("%s", _("Vector dimensions out of range"));
 	return -1;
     }
 
     if ((vt == RVEC && vindx >= A->cols) || (vt == CVEC && vindx >= A->rows)) {
-	G_warning(_("Row/column out of range"));
+	G_warning("%s", _("Row/column out of range"));
 	return -1;
     }
 
@@ -1229,7 +1229,7 @@
     int i;
 
     if (!vc->is_init) {
-	G_warning(_("Matrix is not initialised"));
+	G_warning("%s", _("Matrix is not initialised"));
 	return 0.0 / 0.0;	/* NaN */
     }
 
@@ -1267,7 +1267,7 @@
     int cnt;
 
     if (!vc1->is_init) {
-	G_warning(_("Vector structure is not initialised"));
+	G_warning("%s", _("Vector structure is not initialised"));
 	return NULL;
     }
 
@@ -1388,7 +1388,7 @@
     }
 
     if (sscanf(buff, "Matrix: %d by %d", &rows, &cols) != 2) {
-	G_warning(_("Input format error"));
+	G_warning("%s", _("Input format error"));
 	return -1;
     }
 
@@ -1396,12 +1396,12 @@
 
     for (i = 0; i < rows; i++) {
 	if (fscanf(fp, "row%d:", &row) != 1 || row != i) {
-	    G_warning(_("Input format error"));
+	    G_warning("%s", _("Input format error"));
 	    return -1;
 	}
 	for (j = 0; j < cols; j++) {
 	    if (fscanf(fp, "%lf:", &val) != 1) {
-		G_warning(_("Input format error"));
+		G_warning("%s", _("Input format error"));
 		return -1;
 	    }
 
Index: lib/proj/datum.c
===================================================================
--- lib/proj/datum.c	(revision 61581)
+++ lib/proj/datum.c	(working copy)
@@ -320,7 +320,7 @@
 	    /* Search through the linked list to find the parameter string
 	     * that corresponds to the number entered */
 	    if (list->count == currenttransform)
-		G_asprintf(params, list->params);
+		G_asprintf(params, "%s", list->params);
 
 	    /* Continue to end of list even after we find it, to free all
 	     * the memory used */
@@ -347,7 +347,7 @@
 	    G_strip(answer);
 	    if (strlen(answer) == 0)
 		return -1;
-	    G_asprintf(params, answer);
+	    G_asprintf(params, "%s", answer);
 	    sprintf(buff,
 		    "Parameters to be used are:\n\"%s\"\nIs this correct?",
 		    *params);
Index: lib/proj/get_proj.c
===================================================================
--- lib/proj/get_proj.c	(revision 61581)
+++ lib/proj/get_proj.c	(working copy)
@@ -234,7 +234,7 @@
 	    sprintf(err, " +%s", opt_in[i]);
 	    strcat(buffa, err);
 	}
-	G_warning(buffa);
+	G_warning("%s", buffa);
 	G_warning(_("The error message: %s"), pj_strerrno(pj_errno));
 	return -1;
     }
Index: lib/raster/io_sock.c
===================================================================
--- lib/raster/io_sock.c	(revision 61581)
+++ lib/raster/io_sock.c	(working copy)
@@ -60,8 +60,8 @@
 
     if (!name) {
 	if (verbose) {
-	    G_warning(_("No graphics monitor has been selected for output."));
-	    G_warning(_("Please run \"d.mon\" to select a graphics monitor."));
+	    G_warning("%s", _("No graphics monitor has been selected for output."));
+	    G_warning("%s", _("Please run \"d.mon\" to select a graphics monitor."));
 	}
 	return (NO_MON);
     }
@@ -69,7 +69,7 @@
     /* Get the full path to the unix socket */
     if ((sockpath = G_sock_get_fname(name)) == NULL) {
 	if (verbose)
-	    G_warning(_("Failed to get socket name for monitor <%s>."), name);
+	    G_warning("%s", _("Failed to get socket name for monitor <%s>."), name);
 	return (NO_MON);
     }
 
@@ -78,7 +78,7 @@
      */
     if (!G_sock_exists(sockpath)) {
 	if (verbose)
-	    G_warning(_("No socket to connect to for monitor <%s>."), name);
+	    G_warning("%s", _("No socket to connect to for monitor <%s>."), name);
 	return (NO_MON);
     }
 
@@ -95,21 +95,21 @@
     case ECONNREFUSED:
     case EADDRINUSE:
 	if (verbose) {
-	    G_warning(_("Socket is already in use or not accepting connections."));
-	    G_warning(_("Use d.mon to select a monitor"));
+	    G_warning("%s", _("Socket is already in use or not accepting connections."));
+	    G_warning("%s", _("Use d.mon to select a monitor"));
 	}
 	return (NO_RUN);
     case EBADF:
     case ENOTSOCK:
 	if (verbose) {
-	    G_warning(_("Trying to connect to something not a socket."));
-	    G_warning(_("Probably program error."));
+	    G_warning("%s", _("Trying to connect to something not a socket."));
+	    G_warning("%s", _("Probably program error."));
 	}
 	return (NO_RUN);
     case ETIMEDOUT:
 	if (verbose) {
-	    G_warning(_("Connect attempt timed out."));
-	    G_warning(_("Probably an error with the server."));
+	    G_warning("%s", _("Connect attempt timed out."));
+	    G_warning("%s", _("Probably an error with the server."));
 	}
 	return (NO_RUN);
     default:
@@ -117,7 +117,7 @@
     }
 
     if (verbose)
-	G_warning(_("Connection failed."));
+	G_warning("%s", _("Connection failed."));
 
     /* We couldn't connect... */
     return (NO_RUN);
Index: lib/sites/sites.c
===================================================================
--- lib/sites/sites.c	(revision 61581)
+++ lib/sites/sites.c	(working copy)
@@ -240,7 +240,7 @@
 	     (struct TimeStamp *)G_malloc(sizeof(struct TimeStamp))) == NULL)
 	    G_fatal_error(_("Memory error in allocating timestamp"));
 	if (G_scan_timestamp(head->time, head->stime) < 0) {
-	    G_warning(datetime_error_msg());
+	    G_warning("%s", datetime_error_msg());
 
 	    head->time = NULL;
 	    head->stime = NULL;
Index: lib/symbol/read.c
===================================================================
--- lib/symbol/read.c	(revision 61581)
+++ lib/symbol/read.c	(working copy)
@@ -221,7 +221,7 @@
 {
     fclose(fp);
     G_free(s);			/* TODO: free all */
-    G_warning(msg);
+    G_warning("%s", msg);
     return NULL;
 }
 
Index: lib/vector/Vlib/open.c
===================================================================
--- lib/vector/Vlib/open.c	(revision 61581)
+++ lib/vector/Vlib/open.c	(working copy)
@@ -60,10 +60,10 @@
 {
     switch (ferror) {
     case GV_FATAL_EXIT:
-	G_fatal_error(errmsg);
+	G_fatal_error("%s", errmsg);
 	break;
     case GV_FATAL_PRINT:
-	G_warning(errmsg);
+	G_warning("%s", errmsg);
 	break;
     case GV_FATAL_RETURN:
 	break;
Index: raster/r.describe/describe.c
===================================================================
--- raster/r.describe/describe.c	(revision 61581)
+++ raster/r.describe/describe.c	(working copy)
@@ -46,7 +46,7 @@
 	if (G_get_cellhd(name, mapset, &window) < 0) {
 	    sprintf(msg, "can't get cell header for [%s] in [%s]", name,
 		    mapset);
-	    G_fatal_error(msg);
+	    G_fatal_error("%s", msg);
 	}
 	G_set_window(&window);
 	get_row = G_get_c_raster_row_nomask;
Index: raster/r.external/main.c
===================================================================
--- raster/r.external/main.c	(revision 61581)
+++ raster/r.external/main.c	(working copy)
@@ -174,7 +174,7 @@
 	    strcat(error_msg,
 		   _("Consider generating a new location from the input dataset using "
 		     "the 'location' parameter.\n"));
-	    G_fatal_error(error_msg);
+	    G_fatal_error("%s", error_msg);
 	}
 	else {
 	    G_message(_("Projection of input dataset and current location "
Index: raster/r.flow/mem.h
===================================================================
--- raster/r.flow/mem.h	(revision 61581)
+++ raster/r.flow/mem.h	(working copy)
@@ -37,7 +37,7 @@
 		   segment_get_row(l.seg, l.buf[row] - l.col_offset, \
 				          row + l.row_offset) < 1)) ? \
 	(sprintf(string, "r.flow: cannot write segment file for %s", l.name),\
-	 G_fatal_error(string), (DCELL *) NULL) : \
+	 G_fatal_error("%s", string), (DCELL *) NULL) : \
 	l.buf[row])
 
 /*   This was is Astley's version 12...
@@ -56,7 +56,7 @@
 	(segment_get(as.seg, &v, \
 			row + as.row_offset, col + as.col_offset) < 1 ? \
 	  (sprintf(string,"r.flow: cannot read segment file for %s",as.name), \
-	   G_fatal_error(string)) : \
+	   G_fatal_error("%s", string)) : \
 	  v) : \
 	(parm.mem ? \
 	   aspect_fly(el.buf[row - 1] + col, \
@@ -68,7 +68,7 @@
     (parm.seg ? \
 	(segment_get(l.seg, &v, row + l.row_offset, col + l.col_offset) < 1 ? \
 	  (sprintf(string,"r.flow: cannot read segment file for %s",l.name),\
-	   G_fatal_error(string)) : \
+	   G_fatal_error("%s", string)) : \
 	 v) : \
 	l.buf[row][col])
 
@@ -77,6 +77,6 @@
 	(v = w, \
 	 segment_put(l.seg, &v, row + l.row_offset, col + l.col_offset) < 1 ? \
 	  (sprintf(string,"r.flow: cannot write segment file for %s",l.name), \
-	   G_fatal_error(string)) : \
+	   G_fatal_error("%s", string)) : \
 	 0) : \
 	(l.buf[row][col] = w))
Index: raster/r.in.arc/gethead.c
===================================================================
--- raster/r.in.arc/gethead.c	(revision 61581)
+++ raster/r.in.arc/gethead.c	(working copy)
@@ -86,7 +86,7 @@
 	}
 
 	G_warning(_("Illegal line in header"));
-	G_warning(buf);
+	G_warning("%s", buf);
 
 	missing(s, "yllcorner");
 	missing(w, "xllcorner");
@@ -98,7 +98,7 @@
     }
 
     if (err = G_adjust_Cell_head(cellhd, 1, 1)) {
-	G_warning(err);
+	G_warning("%s", err);
 	return 0;
     }
 
Index: raster/r.in.ascii/gethead.c
===================================================================
--- raster/r.in.ascii/gethead.c	(revision 61581)
+++ raster/r.in.ascii/gethead.c	(working copy)
@@ -221,7 +221,7 @@
     }
 
     if ((err = G_adjust_Cell_head(cellhd, 1, 1))) {
-	G_warning(err);
+	G_warning("%s", err);
 	return 0;
     }
 
Index: raster/r.in.gdal/main.c
===================================================================
--- raster/r.in.gdal/main.c	(revision 61581)
+++ raster/r.in.gdal/main.c	(working copy)
@@ -443,7 +443,7 @@
 		strcat(error_msg,
 		       _("Consider generating a new location from the input dataset using "
 			"the 'location' parameter.\n"));
-		G_fatal_error(error_msg);
+		G_fatal_error("%s", error_msg);
 	    }
 	    else {
 		G_message(_("Projection of input dataset and current location "
@@ -688,7 +688,7 @@
 		target_mapset, pszDstLoc);
 	strcat(errbuf, permissions == 0 ? _("permission denied")
 	       : _("not found"));
-	G_fatal_error(errbuf);
+	G_fatal_error("%s", errbuf);
     }				/* permission check */
 
     /* And switch back to original location */
Index: raster/r.in.mat/main.c
===================================================================
--- raster/r.in.mat/main.c	(revision 61581)
+++ raster/r.in.mat/main.c	(working copy)
@@ -407,10 +407,10 @@
     region.zone = G_zone();
     buff = G_adjust_Cell_head(&region, 1, 1);
     if (buff)
-	G_fatal_error(buff);
+	G_fatal_error("%s", buff);
     G_set_window(&region);
 
-    G_verbose_message("");
+    G_verbose_message("%s", "");
     G_verbose_message(_("Map <%s> bounds set to:"), map_name);
     G_verbose_message(_("northern edge=%f"), region.north);
     G_verbose_message(_("southern edge=%f"), region.south);
@@ -420,7 +420,7 @@
     G_verbose_message(_("ewres=%f"), region.ew_res);
     G_verbose_message(_("rows=%d"), region.rows);
     G_verbose_message(_("cols=%d"), region.cols);
-    G_verbose_message("");
+    G_verbose_message("%s", "");
 
     /* prep memory */
     raster = G_allocate_raster_buf(map_type);
Index: raster/r.in.xyz/main.c
===================================================================
--- raster/r.in.xyz/main.c	(revision 61581)
+++ raster/r.in.xyz/main.c	(working copy)
@@ -1059,7 +1059,7 @@
 
 
     sprintf(buff, _("%lu points found in region."), count_total);
-    G_done_msg(buff);
+    G_done_msg("%s", buff);
     G_debug(1, "Processed %lu lines.", line);
 
     exit(EXIT_SUCCESS);
Index: raster/r.le/r.le.patch/driver.c
===================================================================
--- raster/r.le/r.le.patch/driver.c	(revision 61581)
+++ raster/r.le/r.le.patch/driver.c	(working copy)
@@ -2565,12 +2565,9 @@
 	    }
 	}
 	if (3 > (fvalue[0] = (float)i)) {
-	    buf = G_malloc(40);
-	    sprintf(buf,
+	    G_fatal_error(
 		    "\n No data in file\"%s\"; use r.le.setup to make file\n",
 		    path);
-	    G_fatal_error(buf);
-	    G_free(buf);
 	}
     }
     fclose(fp);
Index: raster/r.out.vrml/main.c
===================================================================
--- raster/r.out.vrml/main.c	(revision 61581)
+++ raster/r.out.vrml/main.c	(working copy)
@@ -34,7 +34,7 @@
     int elevfd = 0, colorfd = 0;
     FILE *vout = NULL;
     struct Colors colr;
-    char errbuf[100], outfile[256];
+    char outfile[256];
     int shh, color_ok;
     double exag, min, max;
     struct GModule *module;
@@ -84,13 +84,11 @@
     t_mapset = NULL;
     t_mapset = G_find_file2("cell", rast_el->answer, "");
     if (!t_mapset) {
-	sprintf(errbuf, "Couldn't find raster map %s", rast_el->answer);
-	G_fatal_error(errbuf);
+	G_fatal_error("Couldn't find raster map %s", rast_el->answer);
     }
     if ((elevfd = G_open_cell_old(rast_el->answer, t_mapset)) == -1) {
-	sprintf(errbuf, "Not able to open cellfile for [%s]",
+	G_fatal_error("Not able to open cellfile for [%s]",
 		rast_el->answer);
-	G_fatal_error(errbuf);
     }
 
     {
@@ -103,10 +101,9 @@
 	is_fp = G_raster_map_is_fp(rast_el->answer, t_mapset);
 	if (is_fp) {
 	    if (G_read_fp_range(rast_el->answer, t_mapset, &fp_range) != 1) {
-		sprintf(errbuf,
+		G_fatal_error(
 			"Range info for [%s] not available (run r.support)\n",
 			rast_el->answer);
-		G_fatal_error(errbuf);
 	    }
 	    G_get_fp_range_min_max(&fp_range, &dmin, &dmax);
 	    min = dmin;
@@ -114,10 +111,9 @@
 	}
 	else {
 	    if (G_read_range(rast_el->answer, t_mapset, &range) == -1) {
-		sprintf(errbuf,
+		G_fatal_error(
 			"Range info for [%s] not available (run r.support)\n",
 			rast_el->answer);
-		G_fatal_error(errbuf);
 	    }
 	    G_get_range_min_max(&range, &cmin, &cmax);
 	    min = cmin;
@@ -129,13 +125,11 @@
 	t_mapset = NULL;
 	t_mapset = G_find_file2("cell", rast_co->answer, "");
 	if (!t_mapset) {
-	    sprintf(errbuf, "Couldn't find raster map %s", rast_co->answer);
-	    G_warning(errbuf);
+	    G_warning("Couldn't find raster map %s", rast_co->answer);
 	}
 	else if ((colorfd = G_open_cell_old(rast_co->answer, t_mapset)) == -1) {
-	    sprintf(errbuf, "Not able to open cellfile for [%s]",
+	    G_warning("Not able to open cellfile for [%s]",
 		    rast_co->answer);
-	    G_warning(errbuf);
 	}
 	else {
 	    G_read_colors(rast_co->answer, t_mapset, &colr);
@@ -162,8 +156,7 @@
 	/* open file for writing VRML */
 	G_message(_("Opening %s for writing... "), outfile);
 	if (NULL == (vout = fopen(outfile, "w"))) {
-	    sprintf(errbuf, "Couldn't open output file %s", outfile);
-	    G_fatal_error(errbuf);
+	    G_fatal_error("Couldn't open output file %s", outfile);
 	}
     }
 
Index: raster/r.profile/main.c
===================================================================
--- raster/r.profile/main.c	(revision 61581)
+++ raster/r.profile/main.c	(working copy)
@@ -181,7 +181,7 @@
 	sprintf(formatbuff, _("[Along Track Dist.(m)] [Elevation]"));
     if (clr)
 	strcat(formatbuff, _(" [RGB Color]"));
-    G_message(formatbuff);
+    G_message("%s", formatbuff);
 
     /* Get Profile Start Coords */
     if (!parm.profile->answer && !parm.i->answer) {
Index: raster/r.profile/read_rast.c
===================================================================
--- raster/r.profile/read_rast.c	(revision 61581)
+++ raster/r.profile/read_rast.c	(working copy)
@@ -46,7 +46,7 @@
 			  row);
 
 	if (outofbounds || G_is_c_null_value(&cell[col]))
-	    sprintf(buf, null_string);
+	    sprintf(buf, "%s", null_string);
 	else
 	    sprintf(buf, "%d", cell[col]);
 
@@ -74,7 +74,7 @@
 			  row);
 
 	if (outofbounds || G_is_f_null_value(&fcell[col]))
-	    sprintf(buf, null_string);
+	    sprintf(buf, "%s", null_string);
 	else
 	    sprintf(buf, "%f", fcell[col]);
 
@@ -102,7 +102,7 @@
 			  row);
 
 	if (outofbounds || G_is_d_null_value(&dcell[col]))
-	    sprintf(buf, null_string);
+	    sprintf(buf, "%s", null_string);
 	else
 	    sprintf(buf, "%f", dcell[col]);
 
Index: raster/r.quant/main.c
===================================================================
--- raster/r.quant/main.c	(revision 61581)
+++ raster/r.quant/main.c	(working copy)
@@ -24,7 +24,6 @@
 
 int main(int argc, char *argv[])
 {
-    char buf[1024];
     struct GModule *module;
     struct Option *input, *basemap, *fprange, *range;
     struct Flag *trunc, *rnd;
@@ -93,14 +92,12 @@
 	name[noi] = G_store(input->answers[noi]);
 	mapset[noi] = G_find_cell2(name[noi], "");
 	if (mapset[noi] == NULL) {
-	    sprintf(buf, "%s - not found", name[noi]);
-	    G_fatal_error(buf);
+	    G_fatal_error("%s - not found", name[noi]);
 	}
 
 	if (G_raster_map_type(name[noi], mapset[noi]) == CELL_TYPE) {
-	    sprintf(buf, "%s is integer map, it can't be quantized",
+	    G_fatal_error("%s is integer map, it can't be quantized",
 		    name[noi]);
-	    G_fatal_error(buf);
 	}
     }
 
@@ -122,20 +119,17 @@
     {
 	basemapset = G_find_cell2(basename, "");
 	if (basemapset == NULL) {
-	    sprintf(buf, "%s - not found", basename);
-	    G_fatal_error(buf);
+	    G_fatal_error("%s - not found", basename);
 	}
 
 	if (G_raster_map_type(basename, basemapset) == CELL_TYPE) {
-	    sprintf(buf, "%s is integer map, it can't be used as basemap",
+	    G_fatal_error("%s is integer map, it can't be used as basemap",
 		    basename);
-	    G_fatal_error(buf);
 	}
 
 	if (G_read_quant(basename, basemapset, &quant_struct) <= 0) {
-	    sprintf(buf, "Can't read quant rules for basemap %s! Exiting.",
+	    G_fatal_error("Can't read quant rules for basemap %s! Exiting.",
 		    basename);
-	    G_fatal_error(buf);
 	}
     }
 
Index: raster/r.quant/read_rules.c
===================================================================
--- raster/r.quant/read_rules.c	(revision 61581)
+++ raster/r.quant/read_rules.c	(working copy)
@@ -12,20 +12,17 @@
     struct Range range;
     CELL tmp_min, tmp_max;
     DCELL tmp_dmin, tmp_dmax;
-    char buff[1024];
     int i;
 
     /* read the fpranges and ranges of all input maps */
     for (i = 0; i < noi; i++) {
 	if (G_read_fp_range(name[i], mapset[i], &drange) <= 0) {
-	    sprintf(buff, "Can't read f_range for map %s", name[i]);
-	    G_fatal_error(buff);
+	    G_fatal_error("Can't read f_range for map %s", name[i]);
 	}
 	G_get_fp_range_min_max(&drange, &tmp_dmin, &tmp_dmax);
 
 	if (G_read_range(name[i], mapset[i], &range) <= 0) {
-	    sprintf(buff, "Can't read range for map %s", name[i]);
-	    G_fatal_error(buff);
+	    G_fatal_error("Can't read range for map %s", name[i]);
 	}
 	G_get_range_min_max(&range, &tmp_min, &tmp_max);
 	if (!i || tmp_max > old_max || G_is_c_null_value(&old_max))
Index: raster/r.random.surface/init.c
===================================================================
--- raster/r.random.surface/init.c	(revision 61581)
+++ raster/r.random.surface/init.c	(working copy)
@@ -207,7 +207,7 @@
 		Seeds[i] = Seeds[i] % SEED_MAX;
 		sprintf(msg2, _(" seed is set to %d"), Seeds[i]);
 		strcat(msg, msg2);
-		G_warning(msg);
+		G_warning("%s", msg);
 	    }
 	    else if (Seeds[i] < SEED_MIN) {
 		sprintf(msg, _("Seed (%d) smaller than minimum (%d)"),
@@ -216,7 +216,7 @@
 		    Seeds[i] += SEED_MAX - SEED_MIN;
 		sprintf(msg2, _(" seed is set to %d"), Seeds[i]);
 		strcat(msg, msg2);
-		G_warning(msg);
+		G_warning("%s", msg);
 	    }
 	}			/* /for */
     }				/* /else */
Index: raster/r.reclass/main.c
===================================================================
--- raster/r.reclass/main.c	(revision 61581)
+++ raster/r.reclass/main.c	(working copy)
@@ -124,7 +124,7 @@
 	    }
 	    else {
 		strcat(buf, _(" - invalid reclass rule"));
-		G_fatal_error(buf);
+		G_fatal_error("%s", buf);
 	    }
 	    break;
 
Index: raster/r.resamp.rst/main.c
===================================================================
--- raster/r.resamp.rst/main.c	(revision 61581)
+++ raster/r.resamp.rst/main.c	(working copy)
@@ -718,5 +718,5 @@
 	fclose(Tmp_fd_xy);
 	unlink(Tmp_file_xy);
     }
-    G_fatal_error(str);
+    G_fatal_error("%s", str);
 }
Index: raster/r.rescale/main.c
===================================================================
--- raster/r.rescale/main.c	(revision 61581)
+++ raster/r.rescale/main.c	(working copy)
@@ -110,11 +110,11 @@
     mapset = G_find_cell(old_name, "");
     if (mapset == NULL) {
 	sprintf(buf, "%s - not found\n", old_name);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
     if (G_legal_filename(new_name) < 0) {
 	sprintf(buf, "%s - illegal map name\n", new_name);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
 
     if (parm.from->answer) {
Index: raster/r.rescale.eq/main.c
===================================================================
--- raster/r.rescale.eq/main.c	(revision 61581)
+++ raster/r.rescale.eq/main.c	(working copy)
@@ -115,11 +115,11 @@
     mapset = G_find_cell(old_name, "");
     if (mapset == NULL) {
 	sprintf(buf, "%s - not found\n", old_name);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
     if (G_legal_filename(new_name) < 0) {
 	sprintf(buf, "%s - illegal map name\n", new_name);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
 
     get_stats(old_name, mapset, &statf);
Index: raster/r.surf.contour/bseg_get.c
===================================================================
--- raster/r.surf.contour/bseg_get.c	(revision 61581)
+++ raster/r.surf.contour/bseg_get.c	(working copy)
@@ -4,13 +4,11 @@
 int bseg_get(BSEG * bseg, char * value, int row, int col)
 {
     unsigned char x;
-    char errmsg[200];
 
     if (segment_get(&(bseg->seg), &x, row, col >> 3) < 0) {
-	sprintf(errmsg,
+	G_warning(
 		"bseg_get(): could not read segment file at r:%d c:%d",
 		(int)row, (int)col);
-	G_warning(errmsg);
 	return -1;
     }
     *value = (char) ((x & (1 << (col & 7))) ? 1 : 0);
Index: raster/r.surf.contour/bseg_put.c
===================================================================
--- raster/r.surf.contour/bseg_put.c	(revision 61581)
+++ raster/r.surf.contour/bseg_put.c	(working copy)
@@ -4,13 +4,11 @@
 int bseg_put(BSEG * bseg, char * value, int row, int col)
 {
     unsigned char old_value;
-    char errmsg[200];
 
     if (segment_get(&(bseg->seg), &old_value, row, col >> 3) < 0) {
-	sprintf(errmsg,
+	G_warning(
 		"bseg_put(): could not read segment file at r:%d c:%d",
 		(int)row, (int)col);
-	G_warning(errmsg);
 	return -1;
     }
     if (*value)
@@ -18,10 +16,9 @@
     else
 	old_value &= ~(1 << (col & 7));
     if (segment_put(&(bseg->seg), &old_value, row, col >> 3) < 0) {
-	sprintf(errmsg,
+	G_warning(
 		"bseg_put(): could not write segment file at r:%d c:%d",
 		(int)row, (int)col);
-	G_warning(errmsg);
 	return -2;
     }
     return 0;
Index: raster/r.surf.contour/bseg_read.c
===================================================================
--- raster/r.surf.contour/bseg_read.c	(revision 61581)
+++ raster/r.surf.contour/bseg_read.c	(working copy)
@@ -9,7 +9,6 @@
     int row, nrows;
     int col, ncols;
     int map_fd;
-    char msg[100];
     CELL *buffer;
     char value;
 
@@ -18,9 +17,8 @@
 
     map_fd = G_open_cell_old(map_name, mapset);
     if (map_fd < 0) {
-	sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
+	G_warning("%s(): unable to open file [%s] in [%s], %d",
 		me, map_name, mapset, map_fd);
-	G_warning(msg);
 	return -3;
     }
     nrows = G_window_rows();
@@ -30,9 +28,8 @@
 	if (G_get_map_row(map_fd, buffer, row) < 0) {
 	    G_free(buffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to read file [%s] in [%s], %d %d",
+	    G_warning("%s(): unable to read file [%s] in [%s], %d %d",
 		    me, map_name, mapset, row, nrows);
-	    G_warning(msg);
 	    return -2;
 	}
 	for (col = ncols; col >= 0; col--) {
Index: raster/r.surf.contour/dseg_read.c
===================================================================
--- raster/r.surf.contour/dseg_read.c	(revision 61581)
+++ raster/r.surf.contour/dseg_read.c	(working copy)
@@ -8,7 +8,6 @@
 {
     int row, nrows;
     int map_fd;
-    char msg[100];
     DCELL *buffer;
 
     dseg->name = NULL;
@@ -15,9 +14,8 @@
     dseg->mapset = NULL;
 
     if ((map_fd = G_open_cell_old(map_name, mapset)) < 0) {
-	sprintf(msg, "%s(): unable to open file [%s] in [%s]",
+	G_warning("%s(): unable to open file [%s] in [%s]",
 		me, map_name, mapset);
-	G_warning(msg);
 	return -3;
     }
     nrows = G_window_rows();
@@ -26,17 +24,15 @@
 	if (G_get_d_raster_row(map_fd, buffer, row) < 0) {
 	    G_free(buffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to read file [%s] in [%s]",
+	    G_warning("%s(): unable to read file [%s] in [%s]",
 		    me, map_name, mapset);
-	    G_warning(msg);
 	    return -2;
 	}
 	if (segment_put_row(&(dseg->seg), buffer, row) < 0) {
 	    G_free(buffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to segment put row for [%s] in [%s]",
+	    G_warning("%s(): unable to segment put row for [%s] in [%s]",
 		    me, map_name, mapset);
-	    G_warning(msg);
 	    return (-1);
 	}
     }
Index: raster/r.surf.contour/dseg_write.c
===================================================================
--- raster/r.surf.contour/dseg_write.c	(revision 61581)
+++ raster/r.surf.contour/dseg_write.c	(working copy)
@@ -7,13 +7,11 @@
 {
     int map_fd;
     int row, nrows;
-    char msg[100];
     DCELL *buffer;
 
     map_fd = G_open_raster_new(map_name, DCELL_TYPE);
     if (map_fd < 0) {
-	sprintf(msg, "%s(): unable to open new map layer [%s]", me, map_name);
-	G_warning(msg);
+	G_warning("%s(): unable to open new map layer [%s]", me, map_name);
 	return -1;
     }
     nrows = G_window_rows();
@@ -23,10 +21,9 @@
 	if (G_put_raster_row(map_fd, buffer, DCELL_TYPE) < 0) {
 	    G_free(buffer);
 	    G_unopen_cell(map_fd);
-	    sprintf(msg,
+	    G_warning(
 		    "%s(): unable to write new map layer [%s], row %d",
 		    me, map_name, row);
-	    G_warning(msg);
 	    return -2;
 	}
     }
Index: raster/r.to.rast3/main.c
===================================================================
--- raster/r.to.rast3/main.c	(revision 61581)
+++ raster/r.to.rast3/main.c	(working copy)
@@ -63,7 +63,7 @@
 	    close_input_raster_map(fd[i]);
     }
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
     exit(EXIT_FAILURE);
 
 }
@@ -205,7 +205,7 @@
 
     /*Check for output */
     if (param.output->answer == NULL)
-	G3d_fatalError(_("No output map"));
+	G3d_fatalError("%s", _("No output map"));
 
     /* Figure out the region from the map */
     G3d_initDefaults();
@@ -338,7 +338,7 @@
 
     /* Close files and exit */
     if (!G3d_closeCell(map))
-	G3d_fatalError(_("Error closing 3d raster map"));
+	G3d_fatalError("%s", _("Error closing 3d raster map"));
 
     map = NULL;
 
Index: raster/r.to.rast3elev/main.c
===================================================================
--- raster/r.to.rast3elev/main.c	(revision 61581)
+++ raster/r.to.rast3elev/main.c	(working copy)
@@ -189,7 +189,7 @@
     if (db.elev)
 	close_input_raster_map(db.elev);
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
     exit(EXIT_FAILURE);
 }
 
Index: raster/r.to.vect/areas_io.c
===================================================================
--- raster/r.to.vect/areas_io.c	(revision 61581)
+++ raster/r.to.vect/areas_io.c	(working copy)
@@ -365,7 +365,7 @@
 		}
 
 		db_append_string(&sql, ")");
-		G_debug(3, db_get_string(&sql));
+		G_debug(3, "%s", db_get_string(&sql));
 
 		if (db_execute_immediate(driver, &sql) != DB_OK)
 		    G_fatal_error(_("Cannot insert new row: %s"),
Index: raster/r.to.vect/main.c
===================================================================
--- raster/r.to.vect/main.c	(revision 61581)
+++ raster/r.to.vect/main.c	(working copy)
@@ -189,7 +189,7 @@
 
 	db_append_string(&sql, ")");
 
-	G_debug(3, db_get_string(&sql));
+	G_debug(3, "%s", db_get_string(&sql));
 
 	if (db_execute_immediate(driver, &sql) != DB_OK)
 	    G_fatal_error(_("Unable to create table: %s"),
@@ -268,7 +268,7 @@
 		sprintf(buf, "insert into %s values ( %d, '%s')", Fi->table,
 			cat, db_get_string(&label));
 		db_set_string(&sql, buf);
-		G_debug(3, db_get_string(&sql));
+		G_debug(3, "%s", db_get_string(&sql));
 
 		if (db_execute_immediate(driver, &sql) != DB_OK)
 		    G_fatal_error(_("Unable to insert into table: %s"),
Index: raster/r.to.vect/util.c
===================================================================
--- raster/r.to.vect/util.c	(revision 61581)
+++ raster/r.to.vect/util.c	(working copy)
@@ -150,7 +150,7 @@
 
     db_append_string(&sql, ")");
 
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK)
 	G_fatal_error(_("Cannot insert new row: %s"), db_get_string(&sql));
Index: raster/r.volume/main.c
===================================================================
--- raster/r.volume/main.c	(revision 61581)
+++ raster/r.volume/main.c	(working copy)
@@ -183,7 +183,7 @@
 			"Row=%d Col=%d Cat=%d in clump map [%s]; max=%d.\n",
 			row, col, i, clumpmap, max);
 		strcat(buf, "Cat value > max returned by G_number_of_cats.");
-		G_fatal_error(buf);
+		G_fatal_error("%s", buf);
 	    }
 	    if (i < 1)
 		continue;	/* ignore zeros and negs */
Index: raster/r.water.outlet/legal.c
===================================================================
--- raster/r.water.outlet/legal.c	(revision 61581)
+++ raster/r.water.outlet/legal.c	(working copy)
@@ -8,7 +8,7 @@
 
     if (G_legal_filename(file_name) == -1) {
 	G_asprintf(&buf, _("<%s> is an illegal file name"), file_name);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
 
     return 0;
@@ -21,7 +21,7 @@
     file_mapset = G_find_cell2(file_name, "");
     if (file_mapset == NULL) {
 	G_asprintf(&buf, _("Raster map <%s> not found"), file_name);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
     return (file_mapset);
 }
Index: raster/r.water.outlet/main.c
===================================================================
--- raster/r.water.outlet/main.c	(revision 61581)
+++ raster/r.water.outlet/main.c	(working copy)
@@ -83,7 +83,7 @@
 
     if (G_get_window(&window) < 0) {
 	G_asprintf(&buf, _("Unable to read current window parameters"));
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
 
     strcpy(drain_name, opt1->answer);
Index: raster/r.watershed/seg/bseg_read.c
===================================================================
--- raster/r.watershed/seg/bseg_read.c	(revision 61581)
+++ raster/r.watershed/seg/bseg_read.c	(working copy)
@@ -9,7 +9,6 @@
     int row, nrows;
     int col, ncols;
     int map_fd;
-    char msg[100];
     CELL *buffer;
 
     bseg->name = NULL;
@@ -17,9 +16,8 @@
 
     map_fd = G_open_cell_old(map_name, mapset);
     if (map_fd < 0) {
-	sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
+	G_warning("%s(): unable to open file [%s] in [%s], %d",
 		me, map_name, mapset, map_fd);
-	G_warning(msg);
 	return -3;
     }
     nrows = G_window_rows();
@@ -29,9 +27,8 @@
 	if (G_get_c_raster_row(map_fd, buffer, row) < 0) {
 	    G_free(buffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to read file [%s] in [%s], %d %d",
+	    G_warning("%s(): unable to read file [%s] in [%s], %d %d",
 		    me, map_name, mapset, row, nrows);
-	    G_warning(msg);
 	    return -2;
 	}
 	for (col = ncols; col >= 0; col--) {
Index: raster/r.watershed/seg/cseg_read.c
===================================================================
--- raster/r.watershed/seg/cseg_read.c	(revision 61581)
+++ raster/r.watershed/seg/cseg_read.c	(working copy)
@@ -8,7 +8,6 @@
 {
     int row, nrows;
     int map_fd;
-    char msg[100];
     CELL *buffer;
 
     cseg->name = NULL;
@@ -16,9 +15,8 @@
 
     map_fd = G_open_cell_old(map_name, mapset);
     if (map_fd < 0) {
-	sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
+	G_warning("%s(): unable to open file [%s] in [%s], %d",
 		me, map_name, mapset, map_fd);
-	G_warning(msg);
 	return -3;
     }
     nrows = G_window_rows();
@@ -27,17 +25,15 @@
 	if (G_get_c_raster_row(map_fd, buffer, row) < 0) {
 	    G_free(buffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to read file [%s] in [%s], %d %d",
+	    G_warning("%s(): unable to read file [%s] in [%s], %d %d",
 		    me, map_name, mapset, row, nrows);
-	    G_warning(msg);
 	    return -2;
 	}
 	if (segment_put_row(&(cseg->seg), buffer, row) < 0) {
 	    G_free(buffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to segment put row for [%s] in [%s]",
+	    G_warning("%s(): unable to segment put row for [%s] in [%s]",
 		    me, map_name, mapset);
-	    G_warning(msg);
 	    return (-1);
 	}
     }
Index: raster/r.watershed/seg/dseg_read.c
===================================================================
--- raster/r.watershed/seg/dseg_read.c	(revision 61581)
+++ raster/r.watershed/seg/dseg_read.c	(working copy)
@@ -8,7 +8,6 @@
 {
     int row, nrows, ncols;
     int map_fd;
-    char msg[100];
     double *dbuffer;
 
     dseg->name = NULL;
@@ -16,9 +15,8 @@
 
     map_fd = G_open_cell_old(map_name, mapset);
     if (map_fd < 0) {
-	sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
+	G_warning("%s(): unable to open file [%s] in [%s], %d",
 		me, map_name, mapset, map_fd);
-	G_warning(msg);
 	return -3;
     }
     nrows = G_window_rows();
@@ -28,17 +26,15 @@
 	if (G_get_d_raster_row(map_fd, dbuffer, row) < 0) {
 	    G_free(dbuffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to read file [%s] in [%s], %d %d",
+	    G_warning("%s(): unable to read file [%s] in [%s], %d %d",
 		    me, map_name, mapset, row, nrows);
-	    G_warning(msg);
 	    return -2;
 	}
 	if (segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
 	    G_free(dbuffer);
 	    G_close_cell(map_fd);
-	    sprintf(msg, "%s(): unable to segment put row for [%s] in [%s]",
+	    G_warning("%s(): unable to segment put row for [%s] in [%s]",
 		    me, map_name, mapset);
-	    G_warning(msg);
 	    return (-1);
 	}
     }
Index: raster/r.what/die.c
===================================================================
--- raster/r.what/die.c	(revision 61581)
+++ raster/r.what/die.c	(working copy)
@@ -6,7 +6,7 @@
     char *message;
 
     G_asprintf(&message, "%s: %s %s", G_program_name(), a, b);
-    G_fatal_error(message);
+    G_fatal_error("%s", message);
 
     return;
 }
Index: raster/wildfire/r.spread/collect_ori.c
===================================================================
--- raster/wildfire/r.spread/collect_ori.c	(revision 61581)
+++ raster/wildfire/r.spread/collect_ori.c	(working copy)
@@ -48,7 +48,6 @@
     extern CELL *cell;
     extern CELL *map_base, *map_x_out, *map_y_out, *map_visit;
     extern float *map_out;
-    extern char buf[];
     extern float neg, zero;
     extern int BARRIER;
     extern int nrows, ncols;
@@ -65,10 +64,9 @@
 	    if (*(cell + col) > 0) {
 		/*Check if starting sources legally ? */
 		if (DATA(map_base, row, col) <= 0) {
-		    sprintf(buf,
+		    G_warning(
 			    "can't start from a BARRIER at cell (%d,%d), request ignored\n",
 			    col, row);
-		    G_warning(buf);
 		    continue;
 		}
 
Index: raster3d/r3.cross.rast/main.c
===================================================================
--- raster3d/r3.cross.rast/main.c	(revision 61581)
+++ raster3d/r3.cross.rast/main.c	(working copy)
@@ -62,7 +62,7 @@
     if (elevfd != -1)
 	close_output_map(elevfd);
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
     exit(EXIT_FAILURE);
 
 }
Index: raster3d/r3.in.ascii/main.c
===================================================================
--- raster3d/r3.in.ascii/main.c	(revision 61581)
+++ raster3d/r3.in.ascii/main.c	(working copy)
@@ -56,7 +56,7 @@
 	G3d_closeCell(map);
     }
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
 }
 
 /*---------------------------------------------------------------------------*/
Index: raster3d/r3.in.v5d/main.c
===================================================================
--- raster3d/r3.in.v5d/main.c	(revision 61581)
+++ raster3d/r3.in.v5d/main.c	(working copy)
@@ -46,7 +46,7 @@
 	/* should unopen map here! */
     }
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
 }
 
 /*---------------------------------------------------------------------------*/
Index: raster3d/r3.out.ascii/main.c
===================================================================
--- raster3d/r3.out.ascii/main.c	(revision 61581)
+++ raster3d/r3.out.ascii/main.c	(working copy)
@@ -59,7 +59,7 @@
 
     }
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
 }
 
 /*---------------------------------------------------------------------------*/
Index: raster3d/r3.out.v5d/main.c
===================================================================
--- raster3d/r3.out.v5d/main.c	(revision 61581)
+++ raster3d/r3.out.v5d/main.c	(working copy)
@@ -54,7 +54,7 @@
 	    fatalError(_("Unable to close 3D raster map"));
     }
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
 }
 
 /*---------------------------------------------------------------------------*/
Index: raster3d/r3.to.rast/main.c
===================================================================
--- raster3d/r3.to.rast/main.c	(revision 61581)
+++ raster3d/r3.to.rast/main.c	(working copy)
@@ -60,7 +60,7 @@
 	    G_unopen_cell(fd[i]);
     }
 
-    G3d_fatalError(errorMsg);
+    G3d_fatalError("%s", errorMsg);
     exit(EXIT_FAILURE);
 
 }
Index: vector/v.convert/att.c
===================================================================
--- vector/v.convert/att.c	(revision 61581)
+++ vector/v.convert/att.c	(working copy)
@@ -60,7 +60,7 @@
 	    fi->table, clen);
     db_append_string(&sql, buf);
 
-    G_debug(1, db_get_string(&sql));
+    G_debug(1, "%s", db_get_string(&sql));
 
     driver = db_start_driver(fi->driver);
     if (driver == NULL)
@@ -102,7 +102,7 @@
 	sprintf(buf, "insert into %s values ( %d, '%s')", fi->table, cat,
 		db_get_string(&lab));
 	db_set_string(&sql, buf);
-	G_debug(3, db_get_string(&sql));
+	G_debug(3, "%s", db_get_string(&sql));
 
 	if (db_execute_immediate(driver, &sql) != DB_OK) {
 	    db_close_database(driver);
Index: vector/v.in.ascii/in.c
===================================================================
--- vector/v.in.ascii/in.c	(revision 61581)
+++ vector/v.in.ascii/in.c	(working copy)
@@ -380,7 +380,7 @@
 				Fi->driver);
 
 	    /* Create table */
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 	    if (db_execute_immediate(driver, &sql) != DB_OK) {
 		Vect_delete(new->answer);
 		G_fatal_error(_("Unable to create table: %s"),
Index: vector/v.in.ascii/points.c
===================================================================
--- vector/v.in.ascii/points.c	(revision 61581)
+++ vector/v.in.ascii/points.c	(working copy)
@@ -399,7 +399,7 @@
 		db_append_string(&sql, buf2);
 	    }
 	    db_append_string(&sql, ")");
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 
 	    if (db_execute_immediate(driver, &sql) != DB_OK) {
 		G_fatal_error(_("Unable to insert new record: %s"),
Index: vector/v.in.dwg/entity.c
===================================================================
--- vector/v.in.dwg/entity.c	(revision 61581)
+++ vector/v.in.dwg/entity.c	(working copy)
@@ -262,7 +262,7 @@
     db_append_string(&sql, buf);
 
     db_append_string(&sql, ")");
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database(driver);
Index: vector/v.in.dwg/main.c
===================================================================
--- vector/v.in.dwg/main.c	(revision 61581)
+++ vector/v.in.dwg/main.c	(working copy)
@@ -121,7 +121,7 @@
 		initerror, adErrorStr(initerror));
 	if (initerror == AD_UNABLE_TO_OPEN_INIT_FILE)
 	    sprintf(buf, _("%s Cannot open %s"), buf, path);
-	G_fatal_error(buf);
+	G_fatal_error("%s", buf);
     }
     adSetupDwgRead();
     adSetupDxfRead();
@@ -211,7 +211,7 @@
 		Fi->table);
     }
     db_set_string(&sql, buf);
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database(driver);
Index: vector/v.in.ogr/main.c
===================================================================
--- vector/v.in.ogr/main.c	(revision 61581)
+++ vector/v.in.ogr/main.c	(working copy)
@@ -595,7 +595,7 @@
 	    strcat(error_msg,
 		   _("Consider generating a new location with 'location' parameter"
 		    " from input data set.\n"));
-	    G_fatal_error(error_msg);
+	    G_fatal_error("%s", error_msg);
 	}
 	else {
 	    G_message(_("Projection of input dataset and current location "
@@ -779,7 +779,7 @@
 		G_free(Ogr_fieldname);
 	    }
 	    db_append_string(&sql, ")");
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 
 	    driver =
 		db_start_driver_open_database(Fi->driver,
@@ -931,7 +931,7 @@
 		    db_append_string(&sql, buf);
 		}
 		db_append_string(&sql, " )");
-		G_debug(3, db_get_string(&sql));
+		G_debug(3, "%s", db_get_string(&sql));
 
 		if (db_execute_immediate(driver, &sql) != DB_OK) {
 		    db_close_database(driver);
Index: vector/v.in.sites/main.c
===================================================================
--- vector/v.in.sites/main.c	(revision 61581)
+++ vector/v.in.sites/main.c	(working copy)
@@ -151,7 +151,7 @@
     }
     db_append_string(&sql, ")");
 
-    G_debug(1, db_get_string(&sql));
+    G_debug(1, "%s", db_get_string(&sql));
 
     driver = db_start_driver(fi->driver);
     if (driver == NULL)
@@ -232,7 +232,7 @@
 
 	db_append_string(&sql, ")");
 
-	G_debug(3, db_get_string(&sql));
+	G_debug(3, "%s", db_get_string(&sql));
 
 	if (db_execute_immediate(driver, &sql) != DB_OK) {
 	    db_close_database(driver);
Index: vector/v.net.allpairs/main.c
===================================================================
--- vector/v.net.allpairs/main.c	(revision 61581)
+++ vector/v.net.allpairs/main.c	(working copy)
@@ -146,7 +146,7 @@
 	    Fi->table);
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
@@ -234,7 +234,7 @@
 	    sprintf(buf, "insert into %s values (%d, %d, %f)",
 		    Fi->table, spnode[i].cat, spnode[j].cat, cost);
 	    db_set_string(&sql, buf);
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 
 	    if (db_execute_immediate(driver, &sql) != DB_OK) {
 		db_close_database_shutdown_driver(driver);
Index: vector/v.net.centrality/main.c
===================================================================
--- vector/v.net.centrality/main.c	(revision 61581)
+++ vector/v.net.centrality/main.c	(working copy)
@@ -233,7 +233,7 @@
 	    "create table %s(cat integer%s)", Fi->table, db_get_string(&tmp));
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
Index: vector/v.net.components/main.c
===================================================================
--- vector/v.net.components/main.c	(revision 61581)
+++ vector/v.net.components/main.c	(working copy)
@@ -31,7 +31,7 @@
 
     sprintf(buf, "insert into %s values (%d, %d)", Fi->table, cat, comp);
     db_set_string(sql, buf);
-    G_debug(3, db_get_string(sql));
+    G_debug(3, "%s", db_get_string(sql));
 
     if (db_execute_immediate(driver, sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
@@ -140,7 +140,7 @@
     sprintf(buf, "create table %s ( cat integer, comp integer)", Fi->table);
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
Index: vector/v.net.distance/main.c
===================================================================
--- vector/v.net.distance/main.c	(revision 61581)
+++ vector/v.net.distance/main.c	(working copy)
@@ -201,7 +201,7 @@
 	    Fi->table);
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
@@ -250,7 +250,7 @@
 		    tcat, cost);
 
 	    db_set_string(&sql, buf);
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 	    if (db_execute_immediate(driver, &sql) != DB_OK) {
 		db_close_database_shutdown_driver(driver);
 		G_fatal_error(_("Cannot insert new record: %s"),
Index: vector/v.net.flow/main.c
===================================================================
--- vector/v.net.flow/main.c	(revision 61581)
+++ vector/v.net.flow/main.c	(working copy)
@@ -161,7 +161,7 @@
 	    Fi->table);
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
@@ -237,7 +237,7 @@
 	    sprintf(buf, "insert into %s values (%d, %f)", Fi->table, cat,
 		    flow[i] / (double)In.cost_multip);
 	    db_set_string(&sql, buf);
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 
 	    if (db_execute_immediate(driver, &sql) != DB_OK) {
 		db_close_database_shutdown_driver(driver);
Index: vector/v.net.path/path.c
===================================================================
--- vector/v.net.path/path.c	(revision 61581)
+++ vector/v.net.path/path.c	(working copy)
@@ -102,7 +102,7 @@
 	    Fi->table);
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
@@ -302,7 +302,7 @@
 		"insert into %s values ( %d, %d, %d, %d, %d, %f, %f, %f)",
 		Fi->table, cat, id, fcat, tcat, sp, cost, fdist, tdist);
 	db_set_string(&sql, buf);
-	G_debug(3, db_get_string(&sql));
+	G_debug(3, "%s", db_get_string(&sql));
 
 	if (db_execute_immediate(driver, &sql) != DB_OK) {
 	    db_close_database_shutdown_driver(driver);
Index: vector/v.net.timetable/main.c
===================================================================
--- vector/v.net.timetable/main.c	(revision 61581)
+++ vector/v.net.timetable/main.c	(working copy)
@@ -96,7 +96,7 @@
     sprintf(buf, "create table %s (%s)", (*Fi)->table, columns);
 
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(*driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(*driver);
@@ -128,7 +128,7 @@
     sprintf(buf, "insert into %s values (%d, %d, %d, %d, %d, %d)", table, cat,
 	    path, stop_id, index, arrival_time, departure_time);
     db_set_string(&sql, buf);
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
 	G_fatal_error(_("Cannot insert new record: %s"), db_get_string(&sql));
@@ -150,7 +150,7 @@
 	    table, cat, path, from_id, to_id, route_id, index, from_time,
 	    to_time);
     db_set_string(&sql, buf);
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database_shutdown_driver(driver);
 	G_fatal_error(_("Cannot insert new record: %s"), db_get_string(&sql));
Index: vector/v.overlay/area_area.c
===================================================================
--- vector/v.overlay/area_area.c	(revision 61581)
+++ vector/v.overlay/area_area.c	(working copy)
@@ -339,7 +339,7 @@
 
 			db_append_string(&stmt, " )");
 
-			G_debug(3, db_get_string(&stmt));
+			G_debug(3, "%s", db_get_string(&stmt));
 
 			if (db_execute_immediate(driver, &stmt) != DB_OK)
 			    G_warning(_("Unable to insert new record: '%s'"),
Index: vector/v.overlay/line_area.c
===================================================================
--- vector/v.overlay/line_area.c	(revision 61581)
+++ vector/v.overlay/line_area.c	(working copy)
@@ -212,7 +212,7 @@
 
 			    db_append_string(&stmt, " )");
 
-			    G_debug(3, db_get_string(&stmt));
+			    G_debug(3, "%s", db_get_string(&stmt));
 
 			    if (db_execute_immediate(driver, &stmt) != DB_OK)
 				G_warning(_("Unable to insert new record: '%s'"),
Index: vector/v.overlay/main.c
===================================================================
--- vector/v.overlay/main.c	(revision 61581)
+++ vector/v.overlay/main.c	(working copy)
@@ -517,7 +517,7 @@
 
 	db_append_string(&stmt, " )");
 
-	G_debug(3, db_get_string(&stmt));
+	G_debug(3, "%s", db_get_string(&stmt));
 
 	if (db_execute_immediate(driver, &stmt) != DB_OK) {
 	    Vect_close(&Out);
Index: vector/v.random/main.c
===================================================================
--- vector/v.random/main.c	(revision 61581)
+++ vector/v.random/main.c	(working copy)
@@ -185,7 +185,7 @@
 			    Fi->driver);
 
 	/* Create table */
-	G_debug(3, db_get_string(&sql));
+	G_debug(3, "%s", db_get_string(&sql));
 	if (db_execute_immediate(driver, &sql) != DB_OK) {
 	    db_close_database(driver);
 	    db_shutdown_driver(driver);
@@ -292,7 +292,7 @@
 		sprintf(buf, "%.0f )", z);
 	    db_append_string(&sql, buf);
 
-	    G_debug(3, db_get_string(&sql));
+	    G_debug(3, "%s", db_get_string(&sql));
 	    if (db_execute_immediate(driver, &sql) != DB_OK) {
 		db_close_database(driver);
 		db_shutdown_driver(driver);
Index: vector/v.surf.rst/main.c
===================================================================
--- vector/v.surf.rst/main.c	(revision 61581)
+++ vector/v.surf.rst/main.c	(working copy)
@@ -601,7 +601,7 @@
 	db_append_string(&sql2, "cat integer");
 	db_append_string(&sql2, ", flt1 double precision");
 	db_append_string(&sql2, ")");
-	G_debug(1, db_get_string(&sql2));
+	G_debug(1, "%s", db_get_string(&sql2));
 	driver2 = db_start_driver_open_database(ff->driver, ff->database);
 	if (driver2 == NULL)
 	    G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
@@ -920,5 +920,5 @@
 	fclose(Tmp_fd_xy);
 	unlink(Tmp_file_xy);
     }
-    G_fatal_error(str);
+    G_fatal_error("%s", str);
 }
Index: vector/v.vol.rst/main.c
===================================================================
--- vector/v.vol.rst/main.c	(revision 61581)
+++ vector/v.vol.rst/main.c	(working copy)
@@ -584,7 +584,7 @@
 	db_append_string(&sql, "cat integer");
 	db_append_string(&sql, ", flt1 double precision");
 	db_append_string(&sql, ")");
-	G_debug(1, db_get_string(&sql));
+	G_debug(1, "%s", db_get_string(&sql));
 	driver = db_start_driver_open_database(f->driver, f->database);
 	if (driver == NULL)
 	    G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
Index: vector/v.vol.rst/user4.c
===================================================================
--- vector/v.vol.rst/user4.c	(revision 61581)
+++ vector/v.vol.rst/user4.c	(working copy)
@@ -74,7 +74,7 @@
 	fclose(Tmp_fd_xy);
 	unlink(Tmp_file_xy);
     }
-    G_fatal_error(str);
+    G_fatal_error("%s", str);
 }
 
 
Index: vector/v.vol.rst/vector.c
===================================================================
--- vector/v.vol.rst/vector.c	(revision 61581)
+++ vector/v.vol.rst/vector.c	(working copy)
@@ -72,7 +72,7 @@
     sprintf(buf, ", %f", err);
     db_append_string(&sql, buf);
     db_append_string(&sql, ")");
-    G_debug(3, db_get_string(&sql));
+    G_debug(3, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
 	db_close_database(driver);
Index: vector/v.what.rast/main.c
===================================================================
--- vector/v.what.rast/main.c	(revision 61581)
+++ vector/v.what.rast/main.c	(working copy)
@@ -178,7 +178,7 @@
 
     nlines = Vect_get_num_lines(&Map);
 
-    G_debug(1, "Reading %d vector features fom map", nlines);
+    G_debug(1, "%s", "Reading %d vector features fom map", nlines);
 
     for (i = 1; i <= nlines; i++) {
 	type = Vect_read_line(&Map, Points, Cats, i);
@@ -351,7 +351,7 @@
 	    sprintf(buf, " AND %s", where_opt->answer);
 	    db_append_string(&stmt, buf);
 	}
-	G_debug(3, db_get_string(&stmt));
+	G_debug(3, "%s", db_get_string(&stmt));
 
 	/* Update table */
 	if (db_execute_immediate(driver, &stmt) == DB_OK) {


More information about the grass-dev mailing list