From 6b20b95af649ecb0d10c8715b295db9796aad4f1 Mon Sep 17 00:00:00 2001 From: Ralf Corsépius Date: Aug 10 2014 09:17:58 +0000 Subject: Add 0004-Eliminate-Werror-format-string-security-issues.patch (RHBZ#1037102) - Re-enable building w/ -Werror=format-security. --- diff --git a/0004-Eliminate-Werror-format-string-security-issues.patch b/0004-Eliminate-Werror-format-string-security-issues.patch new file mode 100644 index 0000000..ee22909 --- /dev/null +++ b/0004-Eliminate-Werror-format-string-security-issues.patch @@ -0,0 +1,3097 @@ +From 76422f2e4f2ee7defabbf866688051307a20d0f7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= +Date: Sun, 10 Aug 2014 06:27:58 +0200 +Subject: [PATCH 4/4] Eliminate -Werror=format-string-security issues. + +--- + db/drivers/dbf/column.c | 2 +- + display/d.colors/main.c | 4 +- + display/d.erase/main.c | 2 +- + display/d.save/main.c | 2 +- + display/d.what.vect/what.c | 2 +- + general/g.mapset/main.c | 2 +- + general/g.setproj/get_stp.c | 2 +- + general/g.setproj/main.c | 6 +- + imagery/i.landsat.toar/landsat_met.c | 4 +- + imagery/i.ortho.photo/i.photo.2image/target.c | 2 +- + imagery/i.ortho.photo/i.photo.2target/target.c | 2 +- + .../i.ortho.photo/i.photo.camera/mod_cam_info.c | 2 +- + imagery/i.ortho.photo/i.photo.elev/ask_elev.c | 4 +- + imagery/i.ortho.photo/i.photo.elev/main.c | 2 +- + imagery/i.ortho.photo/i.photo.rectify/cp.c | 4 +- + imagery/i.ortho.photo/i.photo.rectify/target.c | 2 +- + imagery/i.ortho.photo/libes/camera.c | 3 +- + imagery/i.ortho.photo/libes/conz_points.c | 18 ++-- + imagery/i.ortho.photo/libes/fopen_camera.c | 5 +- + imagery/i.ortho.photo/libes/init_info.c | 11 +-- + imagery/i.ortho.photo/libes/m_mult.c | 2 +- + imagery/i.ortho.photo/libes/open_camera.c | 5 +- + imagery/i.ortho.photo/libes/ref_points.c | 11 +-- + imagery/i.ortho.photo/menu/target.c | 2 +- + imagery/i.pca/support.c | 3 +- + imagery/i.points/target.c | 2 +- + imagery/i.rectify/cp.c | 2 +- + imagery/i.rectify/target.c | 2 +- + imagery/i.vpoints/analyze.c | 4 +- + imagery/i.vpoints/target.c | 2 +- + lib/db/dbmi_base/login.c | 2 +- + lib/db/dbmi_client/delete_tab.c | 2 +- + lib/driver/command.c | 2 +- + lib/g3d/g3derror.c | 2 +- + lib/g3d/g3drange.c | 3 +- + lib/g3d/g3dwindowio.c | 2 +- + lib/gis/get_cellhd.c | 4 +- + lib/gis/get_datum_name.c | 8 +- + lib/gis/get_ellipse.c | 2 +- + lib/gis/history.c | 3 +- + lib/gis/null_val.c | 2 +- + lib/gis/put_cellhd.c | 5 +- + lib/gis/put_title.c | 16 ++-- + lib/gis/quant_io.c | 6 +- + lib/gis/quant_rw.c | 26 ++---- + lib/gis/range.c | 15 ++-- + lib/gis/seek.c | 6 +- + lib/gmath/la.c | 98 +++++++++++----------- + lib/proj/datum.c | 4 +- + lib/proj/get_proj.c | 2 +- + lib/raster/io_sock.c | 22 ++--- + lib/sites/sites.c | 2 +- + lib/symbol/read.c | 2 +- + lib/vector/Vlib/open.c | 4 +- + raster/r.describe/describe.c | 2 +- + raster/r.external/main.c | 2 +- + raster/r.flow/mem.h | 8 +- + raster/r.in.arc/gethead.c | 4 +- + raster/r.in.ascii/gethead.c | 2 +- + raster/r.in.gdal/main.c | 4 +- + raster/r.in.mat/main.c | 6 +- + raster/r.in.xyz/main.c | 2 +- + raster/r.le/r.le.patch/driver.c | 5 +- + raster/r.out.vrml/main.c | 23 ++--- + raster/r.profile/main.c | 2 +- + raster/r.profile/read_rast.c | 6 +- + raster/r.quant/main.c | 16 ++-- + raster/r.quant/read_rules.c | 7 +- + raster/r.random.surface/init.c | 4 +- + raster/r.reclass/main.c | 2 +- + raster/r.resamp.rst/main.c | 2 +- + raster/r.rescale.eq/main.c | 4 +- + raster/r.rescale/main.c | 4 +- + raster/r.surf.contour/bseg_get.c | 4 +- + raster/r.surf.contour/bseg_put.c | 7 +- + raster/r.surf.contour/bseg_read.c | 7 +- + raster/r.surf.contour/dseg_read.c | 10 +-- + raster/r.surf.contour/dseg_write.c | 7 +- + raster/r.to.rast3/main.c | 6 +- + raster/r.to.rast3elev/main.c | 2 +- + raster/r.to.vect/areas_io.c | 2 +- + raster/r.to.vect/main.c | 4 +- + raster/r.to.vect/util.c | 2 +- + raster/r.volume/main.c | 2 +- + raster/r.water.outlet/legal.c | 4 +- + raster/r.water.outlet/main.c | 2 +- + raster/r.watershed/seg/bseg_read.c | 7 +- + raster/r.watershed/seg/cseg_read.c | 10 +-- + raster/r.watershed/seg/dseg_read.c | 10 +-- + raster/r.what/die.c | 2 +- + raster/wildfire/r.spread/collect_ori.c | 4 +- + raster3d/r3.cross.rast/main.c | 2 +- + raster3d/r3.in.ascii/main.c | 2 +- + raster3d/r3.in.v5d/main.c | 2 +- + raster3d/r3.out.ascii/main.c | 2 +- + raster3d/r3.out.v5d/main.c | 2 +- + raster3d/r3.to.rast/main.c | 2 +- + vector/v.convert/att.c | 4 +- + vector/v.in.ascii/in.c | 2 +- + vector/v.in.ascii/points.c | 2 +- + vector/v.in.dwg/entity.c | 2 +- + vector/v.in.dwg/main.c | 4 +- + vector/v.in.ogr/main.c | 6 +- + vector/v.in.sites/main.c | 4 +- + vector/v.net.allpairs/main.c | 4 +- + vector/v.net.centrality/main.c | 2 +- + vector/v.net.components/main.c | 4 +- + vector/v.net.distance/main.c | 4 +- + vector/v.net.flow/main.c | 4 +- + vector/v.net.path/path.c | 4 +- + vector/v.net.timetable/main.c | 6 +- + vector/v.overlay/area_area.c | 2 +- + vector/v.overlay/line_area.c | 2 +- + vector/v.overlay/main.c | 2 +- + vector/v.random/main.c | 4 +- + vector/v.surf.rst/main.c | 4 +- + vector/v.vol.rst/main.c | 2 +- + vector/v.vol.rst/user4.c | 2 +- + vector/v.vol.rst/vector.c | 2 +- + vector/v.what.rast/main.c | 4 +- + 120 files changed, 269 insertions(+), 372 deletions(-) + +diff --git a/db/drivers/dbf/column.c b/db/drivers/dbf/column.c +index c953ee0..2cbe857 100644 +--- a/db/drivers/dbf/column.c ++++ b/db/drivers/dbf/column.c +@@ -39,7 +39,7 @@ int add_column(int tab, int type, char *name, int width, int decimals) + 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 */ +diff --git a/display/d.colors/main.c b/display/d.colors/main.c +index 17c6a6d..413ddb1 100644 +--- a/display/d.colors/main.c ++++ b/display/d.colors/main.c +@@ -75,14 +75,14 @@ int main(int argc, char **argv) + 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)) { + 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 */ +diff --git a/display/d.erase/main.c b/display/d.erase/main.c +index dc7c72d..5662b4a 100644 +--- a/display/d.erase/main.c ++++ b/display/d.erase/main.c +@@ -79,7 +79,7 @@ int main(int argc, char *argv[]) + + R_close_driver(); + if (err) +- G_fatal_error(err); ++ G_fatal_error("%s", err); + + exit(0); + } +diff --git a/display/d.save/main.c b/display/d.save/main.c +index 6a2e8e0..7f60ca9 100644 +--- a/display/d.save/main.c ++++ b/display/d.save/main.c +@@ -454,7 +454,7 @@ int set_item(char *item, char **list) + 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); +diff --git a/display/d.what.vect/what.c b/display/d.what.vect/what.c +index 0b5af4d..5c43fb8 100644 +--- a/display/d.what.vect/what.c ++++ b/display/d.what.vect/what.c +@@ -494,7 +494,7 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth, + fflush(stdout); + if (!txt && !topo) { + db_append_string(&html, ""); +- G_debug(3, db_get_string(&html)); ++ G_debug(3, "%s", db_get_string(&html)); + F_open(title, db_get_string(&html)); + } + +diff --git a/general/g.mapset/main.c b/general/g.mapset/main.c +index 2fe0f49..f04e742 100644 +--- a/general/g.mapset/main.c ++++ b/general/g.mapset/main.c +@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) + 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); +diff --git a/general/g.setproj/get_stp.c b/general/g.setproj/get_stp.c +index 53d4541..dd3170f 100644 +--- a/general/g.setproj/get_stp.c ++++ b/general/g.setproj/get_stp.c +@@ -56,7 +56,7 @@ int get_stp_code(int code, char *string, char *paramfile) + 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) +diff --git a/general/g.setproj/main.c b/general/g.setproj/main.c +index 4dd5e69..c522f75 100644 +--- a/general/g.setproj/main.c ++++ b/general/g.setproj/main.c +@@ -250,9 +250,9 @@ int main(int argc, char *argv[]) + 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")); + } +diff --git a/imagery/i.landsat.toar/landsat_met.c b/imagery/i.landsat.toar/landsat_met.c +index 506d719..e6cf055 100644 +--- a/imagery/i.landsat.toar/landsat_met.c ++++ b/imagery/i.landsat.toar/landsat_met.c +@@ -384,14 +384,14 @@ void lsat_metadata(char *metafile, lsat_data * lsat) + 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); + 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); +diff --git a/imagery/i.ortho.photo/i.photo.2image/target.c b/imagery/i.ortho.photo/i.photo.2image/target.c +index a5774b2..e4c57d1 100644 +--- a/imagery/i.ortho.photo/i.photo.2image/target.c ++++ b/imagery/i.ortho.photo/i.photo.2image/target.c +@@ -46,7 +46,7 @@ int get_target(void) + error: + strcat(buf, "Please run i.target for group "); + strcat(buf, group.name); +- G_fatal_error(buf); ++ G_fatal_error("%s", buf); + + return -1; + } +diff --git a/imagery/i.ortho.photo/i.photo.2target/target.c b/imagery/i.ortho.photo/i.photo.2target/target.c +index 85c4008..df4533e 100644 +--- a/imagery/i.ortho.photo/i.photo.2target/target.c ++++ b/imagery/i.ortho.photo/i.photo.2target/target.c +@@ -81,7 +81,7 @@ G_sleep (3); + 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) +diff --git a/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c b/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c +index fe737d9..c2e0605 100644 +--- a/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c ++++ b/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c +@@ -81,7 +81,7 @@ int mod_cam_info(int have_old, struct Ortho_Camera_File_Ref *cam_info) + 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, +diff --git a/imagery/i.ortho.photo/i.photo.elev/ask_elev.c b/imagery/i.ortho.photo/i.photo.elev/ask_elev.c +index d27e39e..51e11a4 100644 +--- a/imagery/i.ortho.photo/i.photo.elev/ask_elev.c ++++ b/imagery/i.ortho.photo/i.photo.elev/ask_elev.c +@@ -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 @@ int ask_elev(char *group, char *location, char *mapset) + } + + 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; + } +diff --git a/imagery/i.ortho.photo/i.photo.elev/main.c b/imagery/i.ortho.photo/i.photo.elev/main.c +index 023ad6c..5e64ebe 100644 +--- a/imagery/i.ortho.photo/i.photo.elev/main.c ++++ b/imagery/i.ortho.photo/i.photo.elev/main.c +@@ -131,7 +131,7 @@ int main(int argc, char *argv[]) + strcat(buf, _("Please select a target for group")); + strcat(buf, group); + G_suppress_warnings(0); +- G_fatal_error(buf); ++ G_fatal_error("%s", buf); + } + + +diff --git a/imagery/i.ortho.photo/i.photo.rectify/cp.c b/imagery/i.ortho.photo/i.photo.rectify/cp.c +index b8ec48c..86e5b33 100644 +--- a/imagery/i.ortho.photo/i.photo.rectify/cp.c ++++ b/imagery/i.ortho.photo/i.photo.rectify/cp.c +@@ -31,7 +31,7 @@ int get_conz_points(void) + default: + return 1; + } +- G_fatal_error(msg); ++ G_fatal_error("%s", msg); + } + + int get_ref_points(void) +@@ -61,6 +61,6 @@ int get_ref_points(void) + default: + return 1; + } +- G_fatal_error(msg); ++ G_fatal_error("%s", msg); + /* exit(1); shouldn't get here */ + } +diff --git a/imagery/i.ortho.photo/i.photo.rectify/target.c b/imagery/i.ortho.photo/i.photo.rectify/target.c +index 3adf05b..74b8a80 100644 +--- a/imagery/i.ortho.photo/i.photo.rectify/target.c ++++ b/imagery/i.ortho.photo/i.photo.rectify/target.c +@@ -31,5 +31,5 @@ int get_target(char *group) + 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); + } +diff --git a/imagery/i.ortho.photo/libes/camera.c b/imagery/i.ortho.photo/libes/camera.c +index 26e454e..fdf7c99 100644 +--- a/imagery/i.ortho.photo/libes/camera.c ++++ b/imagery/i.ortho.photo/libes/camera.c +@@ -33,10 +33,9 @@ int I_get_group_camera(char *group, char *camera) + 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); +diff --git a/imagery/i.ortho.photo/libes/conz_points.c b/imagery/i.ortho.photo/libes/conz_points.c +index cdadb6e..635d4cb 100644 +--- a/imagery/i.ortho.photo/libes/conz_points.c ++++ b/imagery/i.ortho.photo/libes/conz_points.c +@@ -96,15 +96,13 @@ int I_write_con_points(FILE * fd, struct Ortho_Control_Points *cp) + 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 @@ int I_get_con_points(char *group, struct Ortho_Control_Points *cp) + 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_get_con_points(char *group, struct Ortho_Control_Points *cp) + 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,17 +141,15 @@ int I_convert_con_points(char *group, struct Ortho_Control_Points *con_cp, + double N12[3]) + { + FILE *fd; +- char msg[100]; + int i, stat, status; + double e1, e2, n1, n2, z1, z2, e0, n0; + + + 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 @@ int I_convert_con_points(char *group, struct Ortho_Control_Points *con_cp, + 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; + } +diff --git a/imagery/i.ortho.photo/libes/fopen_camera.c b/imagery/i.ortho.photo/libes/fopen_camera.c +index d798e25..7b2c347 100644 +--- a/imagery/i.ortho.photo/libes/fopen_camera.c ++++ b/imagery/i.ortho.photo/libes/fopen_camera.c +@@ -54,11 +54,8 @@ FILE *I_fopen_cam_file_old(char *camera) + + 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; + } +diff --git a/imagery/i.ortho.photo/libes/init_info.c b/imagery/i.ortho.photo/libes/init_info.c +index 0bb1a67..ab0d6d6 100644 +--- a/imagery/i.ortho.photo/libes/init_info.c ++++ b/imagery/i.ortho.photo/libes/init_info.c +@@ -94,23 +94,20 @@ int I_write_init_info(FILE * fd, struct Ortho_Camera_Exp_Init *init_info) + 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; + } + + 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_get_init_info(char *group, struct Ortho_Camera_Exp_Init *init_info) + 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; + } + +diff --git a/imagery/i.ortho.photo/libes/m_mult.c b/imagery/i.ortho.photo/libes/m_mult.c +index 301ebc0..b93a512 100644 +--- a/imagery/i.ortho.photo/libes/m_mult.c ++++ b/imagery/i.ortho.photo/libes/m_mult.c +@@ -21,7 +21,7 @@ int m_mult(MATRIX * a, MATRIX * b, MATRIX * c) + 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); + } + +diff --git a/imagery/i.ortho.photo/libes/open_camera.c b/imagery/i.ortho.photo/libes/open_camera.c +index 30c6184..6b79136 100644 +--- a/imagery/i.ortho.photo/libes/open_camera.c ++++ b/imagery/i.ortho.photo/libes/open_camera.c +@@ -46,11 +46,8 @@ int I_open_cam_file_old(char *camera, char *file) + + 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; + } +diff --git a/imagery/i.ortho.photo/libes/ref_points.c b/imagery/i.ortho.photo/libes/ref_points.c +index 6f03e8d..2cc726e 100644 +--- a/imagery/i.ortho.photo/libes/ref_points.c ++++ b/imagery/i.ortho.photo/libes/ref_points.c +@@ -88,16 +88,14 @@ int I_write_ref_points(FILE * fd, struct Ortho_Photo_Points *cp) + 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 @@ int I_get_ref_points(char *groupname, struct Ortho_Photo_Points *cp) + 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_get_ref_points(char *groupname, struct Ortho_Photo_Points *cp) + 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; + } + +diff --git a/imagery/i.ortho.photo/menu/target.c b/imagery/i.ortho.photo/menu/target.c +index 60843f2..d590eda 100644 +--- a/imagery/i.ortho.photo/menu/target.c ++++ b/imagery/i.ortho.photo/menu/target.c +@@ -34,5 +34,5 @@ int get_target(char *name, struct Cell_head *target_window) + 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); + } +diff --git a/imagery/i.pca/support.c b/imagery/i.pca/support.c +index 3e83818..67bf600 100644 +--- a/imagery/i.pca/support.c ++++ b/imagery/i.pca/support.c +@@ -63,7 +63,8 @@ static void write_history(int bands, char *outname, double **eigmat, double *eig + 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) +diff --git a/imagery/i.points/target.c b/imagery/i.points/target.c +index da22d8a..92b65d5 100644 +--- a/imagery/i.points/target.c ++++ b/imagery/i.points/target.c +@@ -40,7 +40,7 @@ int get_target(void) + 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) +diff --git a/imagery/i.rectify/cp.c b/imagery/i.rectify/cp.c +index 0a3e4fa..aca5b44 100644 +--- a/imagery/i.rectify/cp.c ++++ b/imagery/i.rectify/cp.c +@@ -40,7 +40,7 @@ int get_control_points(char *group, int order /* THIS HAS BEEN ADDED WITH THE CR + */ + return 1; + } +- G_fatal_error(msg); ++ G_fatal_error("%s", msg); + + return 0; /* G_fatal_error() calls exit() */ + } +diff --git a/imagery/i.rectify/target.c b/imagery/i.rectify/target.c +index 868db6a..aa4d947 100644 +--- a/imagery/i.rectify/target.c ++++ b/imagery/i.rectify/target.c +@@ -34,6 +34,6 @@ int get_target(char *group) + 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 */ + } +diff --git a/imagery/i.vpoints/analyze.c b/imagery/i.vpoints/analyze.c +index f19a3f4..008dc9e 100644 +--- a/imagery/i.vpoints/analyze.c ++++ b/imagery/i.vpoints/analyze.c +@@ -116,11 +116,9 @@ static int delete_mark(void) + 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++) { +diff --git a/imagery/i.vpoints/target.c b/imagery/i.vpoints/target.c +index c245b02..7408592 100644 +--- a/imagery/i.vpoints/target.c ++++ b/imagery/i.vpoints/target.c +@@ -41,7 +41,7 @@ int get_target(void) + error: + strcat(buf, "Please run i.target for group "); + strcat(buf, group.name); +- G_fatal_error(buf); ++ G_fatal_error("%s", buf); + + return -1; + } +diff --git a/lib/db/dbmi_base/login.c b/lib/db/dbmi_base/login.c +index 41b625d..462fb77 100644 +--- a/lib/db/dbmi_base/login.c ++++ b/lib/db/dbmi_base/login.c +@@ -95,7 +95,7 @@ int read_file(LOGIN * login) + ret, dr, db, usr, pwd); + + if (ret < 2) { +- G_warning(_("Login file corrupted")); ++ G_warning("%s", _("Login file corrupted")); + continue; + } + +diff --git a/lib/db/dbmi_client/delete_tab.c b/lib/db/dbmi_client/delete_tab.c +index 98c4ab0..cf053c2 100644 +--- a/lib/db/dbmi_client/delete_tab.c ++++ b/lib/db/dbmi_client/delete_tab.c +@@ -47,7 +47,7 @@ int db_delete_table(const char *drvname, const char *dbname, const char *tblname + 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'"), +diff --git a/lib/driver/command.c b/lib/driver/command.c +index 479037d..cc8fb44 100644 +--- a/lib/driver/command.c ++++ b/lib/driver/command.c +@@ -544,7 +544,7 @@ int get_command(char *c) + 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) +diff --git a/lib/g3d/g3derror.c b/lib/g3d/g3derror.c +index 4c3533f..ea07904 100644 +--- a/lib/g3d/g3derror.c ++++ b/lib/g3d/g3derror.c +@@ -40,7 +40,7 @@ void G3d_skipError(const char *msg) + void G3d_printError(const char *msg) + { + fprintf(stderr, "ERROR: "); +- fprintf(stderr, msg); ++ fprintf(stderr, "%s", msg); + fprintf(stderr, "\n"); + } + +diff --git a/lib/g3d/g3drange.c b/lib/g3d/g3drange.c +index ce0b06b..ede6027 100644 +--- a/lib/g3d/g3drange.c ++++ b/lib/g3d/g3drange.c +@@ -196,8 +196,7 @@ static int writeRange(const char *name, struct FPRange *range) + + 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; + } + +diff --git a/lib/g3d/g3dwindowio.c b/lib/g3d/g3dwindowio.c +index a1aaa76..1a1cd4c 100644 +--- a/lib/g3d/g3dwindowio.c ++++ b/lib/g3d/g3dwindowio.c +@@ -71,7 +71,7 @@ static void G3d_getFullWindowPath(char *path, const char *windowName) + windowName++; + + if (strchr(windowName, GRASS_DIRSEP) || strchr(windowName, HOST_DIRSEP)) { +- sprintf(path, windowName); ++ sprintf(path, "%s", windowName); + return; + } + +diff --git a/lib/gis/get_cellhd.c b/lib/gis/get_cellhd.c +index f015a0f..18197d5 100644 +--- a/lib/gis/get_cellhd.c ++++ b/lib/gis/get_cellhd.c +@@ -78,7 +78,7 @@ int G_get_cellhd(const char *name, const char *mapset, + 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 @@ int G_get_cellhd(const char *name, const char *mapset, + + G_free(err); + +- G_warning(buf); ++ G_warning("%s", buf); + return -1; + } +diff --git a/lib/gis/get_datum_name.c b/lib/gis/get_datum_name.c +index c0d0f48..dde8e05 100644 +--- a/lib/gis/get_datum_name.c ++++ b/lib/gis/get_datum_name.c +@@ -106,15 +106,15 @@ int G_ask_datum_name(char *datumname, char *ellpsname) + /* 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; +diff --git a/lib/gis/get_ellipse.c b/lib/gis/get_ellipse.c +index 04b4dfe..1877aac 100644 +--- a/lib/gis/get_ellipse.c ++++ b/lib/gis/get_ellipse.c +@@ -281,7 +281,7 @@ static int read_ellipsoid_table(int fatal) + 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; + } + +diff --git a/lib/gis/history.c b/lib/gis/history.c +index 9e25039..4b52b71 100644 +--- a/lib/gis/history.c ++++ b/lib/gis/history.c +@@ -270,7 +270,8 @@ int G_command_history(struct History *hist) + } + + 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 */ +diff --git a/lib/gis/null_val.c b/lib/gis/null_val.c +index 1f1d59f..ac92aaf 100644 +--- a/lib/gis/null_val.c ++++ b/lib/gis/null_val.c +@@ -112,7 +112,7 @@ static void InitError(void) + 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; + } +diff --git a/lib/gis/put_cellhd.c b/lib/gis/put_cellhd.c +index 1500ce3..747dfa0 100644 +--- a/lib/gis/put_cellhd.c ++++ b/lib/gis/put_cellhd.c +@@ -21,10 +21,7 @@ int G_put_cellhd(const char *name, struct Cell_head *cellhd) + 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; + } + +diff --git a/lib/gis/put_title.c b/lib/gis/put_title.c +index 36dab0a..41ff3ef 100644 +--- a/lib/gis/put_title.c ++++ b/lib/gis/put_title.c +@@ -25,10 +25,8 @@ int G_put_cell_title(const char *name, const char *title) + 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 @@ int G_put_cell_title(const char *name, const char *title) + 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,25 +50,22 @@ int G_put_cell_title(const char *name, const char *title) + + /* 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; + } + + 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; + } + +diff --git a/lib/gis/quant_io.c b/lib/gis/quant_io.c +index 15205ef..fbe2491 100644 +--- a/lib/gis/quant_io.c ++++ b/lib/gis/quant_io.c +@@ -121,10 +121,9 @@ int G__quant_import(const char *name, const char *mapset, struct Quant *quant) + 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 @@ int G__quant_import(const char *name, const char *mapset, struct Quant *quant) + err = "empty"; + } + +- sprintf(buf, ++ G_warning( + _("quantization file [%s] in mapset [%s] %s"), name, mapset, err); +- G_warning(buf); + + return 0; + } +diff --git a/lib/gis/quant_rw.c b/lib/gis/quant_rw.c +index 2b7bf1b..4c069a8 100644 +--- a/lib/gis/quant_rw.c ++++ b/lib/gis/quant_rw.c +@@ -63,16 +63,14 @@ + + int G_truncate_fp_map(const char *name, const char *mapset) + { +- char buf[300]; + struct Quant quant; + + G_quant_init(&quant); + 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,16 +78,14 @@ int G_truncate_fp_map(const char *name, const char *mapset) + + int G_round_fp_map(const char *name, const char *mapset) + { +- char buf[300]; + struct Quant quant; + + G_quant_init(&quant); + 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_round_fp_map(const char *name, const char *mapset) + 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,17 +152,15 @@ int G_quantize_fp_map(const char *name, const char *mapset, + 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); + 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 @@ int G_write_quant(const char *name, const char *mapset, + { + 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 @@ int G_write_quant(const char *name, const char *mapset, + + /* 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; + } + +diff --git a/lib/gis/range.c b/lib/gis/range.c +index ebd8232..a0f4dab 100644 +--- a/lib/gis/range.c ++++ b/lib/gis/range.c +@@ -189,8 +189,7 @@ int G_read_fp_range(const char *name, const char *mapset, + 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 @@ int G_read_range(const char *name, const char *mapset, struct Range *range) + 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 @@ int G_read_range(const char *name, const char *mapset, struct Range *range) + 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 @@ int G_write_range(const char *name, const struct Range *range) + + 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 @@ int G_write_fp_range(const char *name, const struct FPRange *range) + + 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; + } + +diff --git a/lib/gis/seek.c b/lib/gis/seek.c +index 747e103..e0a928a 100644 +--- a/lib/gis/seek.c ++++ b/lib/gis/seek.c +@@ -49,12 +49,12 @@ void G_fseek(FILE *fp, off_t offset, int whence) + { + #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 + } +diff --git a/lib/gmath/la.c b/lib/gmath/la.c +index 7ca37c4..3205bfe 100644 +--- a/lib/gmath/la.c ++++ b/lib/gmath/la.c +@@ -57,7 +57,7 @@ mat_struct *G_matrix_init(int rows, int cols, int ldim) + 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_zero(mat_struct * A) + 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 *G_matrix_copy(const mat_struct * A) + 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 @@ mat_struct *G__matrix_add(mat_struct * mt1, mat_struct * mt2, const double c1, + 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 @@ mat_struct *G__matrix_add(mat_struct * mt1, mat_struct * mt2, const double c1, + 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 @@ mat_struct *G_matrix_product(mat_struct * mt1, mat_struct * mt2) + 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 @@ G_matrix_LU_solve(const mat_struct * mt1, mat_struct ** xmat0, + 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 @@ G_matrix_LU_solve(const mat_struct * mt1, mat_struct ** xmat0, + 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,18 +524,18 @@ G_matrix_LU_solve(const mat_struct * mt1, mat_struct ** xmat0, + 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; + } + 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 @@ mat_struct *G_matrix_inverse(mat_struct * mt) + 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 @@ mat_struct *G_matrix_inverse(mat_struct * mt) + + /* 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 @@ void G_matrix_print(mat_struct * mt) + 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 *G_matvect_get_column(mat_struct * mt, int col) + 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 *G_matvect_get_row(mat_struct * mt, int row) + 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 @@ vec_struct *G_matvect_get_row(mat_struct * mt, int row) + 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 @@ int G_matvect_extract_vector(mat_struct * mt, vtype vt, int indx) + + default: + { +- G_warning(_("Unknown vector type.")); ++ G_warning("%s", _("Unknown vector type.")); + return -1; + } + +@@ -974,34 +974,34 @@ vec_struct *G_vector_sub(vec_struct * v1, vec_struct * v2, vec_struct * out) + 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 @@ int G_vector_set(vec_struct * A, int cells, int ldim, vtype vt, int vindx) + { + 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 @@ double G_vector_norm1(vec_struct * vc) + 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 @@ vec_struct *G_vector_copy(const vec_struct * vc1, int comp_flag) + 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 @@ int G_matrix_read(FILE * fp, mat_struct * out) + } + + 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 @@ int G_matrix_read(FILE * fp, mat_struct * out) + + 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; + } + +diff --git a/lib/proj/datum.c b/lib/proj/datum.c +index 43a3365..dfb8a55 100644 +--- a/lib/proj/datum.c ++++ b/lib/proj/datum.c +@@ -320,7 +320,7 @@ int GPJ_ask_datum_params(const char *datumname, char **params) + /* 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 @@ int GPJ_ask_datum_params(const char *datumname, char **params) + 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); +diff --git a/lib/proj/get_proj.c b/lib/proj/get_proj.c +index 1a4e840..0ba19a5 100644 +--- a/lib/proj/get_proj.c ++++ b/lib/proj/get_proj.c +@@ -234,7 +234,7 @@ int pj_get_kv(struct pj_info *info, struct Key_Value *in_proj_keys, + 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; + } +diff --git a/lib/raster/io_sock.c b/lib/raster/io_sock.c +index 0a43f6d..fa90045 100644 +--- a/lib/raster/io_sock.c ++++ b/lib/raster/io_sock.c +@@ -60,8 +60,8 @@ int REM_open_driver(void) + + 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 @@ int REM_open_driver(void) + /* 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 @@ int REM_open_driver(void) + */ + 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 @@ int REM_open_driver(void) + 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 @@ int REM_open_driver(void) + } + + if (verbose) +- G_warning(_("Connection failed.")); ++ G_warning("%s", _("Connection failed.")); + + /* We couldn't connect... */ + return (NO_RUN); +diff --git a/lib/sites/sites.c b/lib/sites/sites.c +index d4fef09..0a10ea1 100644 +--- a/lib/sites/sites.c ++++ b/lib/sites/sites.c +@@ -240,7 +240,7 @@ int G_site_get_head(struct Map_info *Map, Site_head * head) + (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; +diff --git a/lib/symbol/read.c b/lib/symbol/read.c +index c0b0c46..037c827 100644 +--- a/lib/symbol/read.c ++++ b/lib/symbol/read.c +@@ -221,7 +221,7 @@ SYMBOL *err(FILE * fp, SYMBOL * s, char *msg) + { + fclose(fp); + G_free(s); /* TODO: free all */ +- G_warning(msg); ++ G_warning("%s", msg); + return NULL; + } + +diff --git a/lib/vector/Vlib/open.c b/lib/vector/Vlib/open.c +index bfb2953..aa05ab7 100644 +--- a/lib/vector/Vlib/open.c ++++ b/lib/vector/Vlib/open.c +@@ -60,10 +60,10 @@ static void fatal_error(int ferror, char *errmsg) + { + 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; +diff --git a/raster/r.describe/describe.c b/raster/r.describe/describe.c +index 719de3e..da6fdb3 100644 +--- a/raster/r.describe/describe.c ++++ b/raster/r.describe/describe.c +@@ -46,7 +46,7 @@ int describe(char *name, char *mapset, int compact, char *no_data_str, + 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; +diff --git a/raster/r.external/main.c b/raster/r.external/main.c +index ab72f0f..09c2eca 100644 +--- a/raster/r.external/main.c ++++ b/raster/r.external/main.c +@@ -174,7 +174,7 @@ static void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int ove + 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 " +diff --git a/raster/r.flow/mem.h b/raster/r.flow/mem.h +index 169e487..6e44f29 100644 +--- a/raster/r.flow/mem.h ++++ b/raster/r.flow/mem.h +@@ -37,7 +37,7 @@ void put_row_seg( /* l, row */ ); + 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 @@ void put_row_seg( /* l, row */ ); + (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 @@ void put_row_seg( /* l, row */ ); + (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 @@ void put_row_seg( /* l, row */ ); + (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)) +diff --git a/raster/r.in.arc/gethead.c b/raster/r.in.arc/gethead.c +index 10105ee..3a25d96 100644 +--- a/raster/r.in.arc/gethead.c ++++ b/raster/r.in.arc/gethead.c +@@ -86,7 +86,7 @@ int gethead(FILE * fd, struct Cell_head *cellhd, int *missingval) + } + + G_warning(_("Illegal line in header")); +- G_warning(buf); ++ G_warning("%s", buf); + + missing(s, "yllcorner"); + missing(w, "xllcorner"); +@@ -98,7 +98,7 @@ int gethead(FILE * fd, struct Cell_head *cellhd, int *missingval) + } + + if (err = G_adjust_Cell_head(cellhd, 1, 1)) { +- G_warning(err); ++ G_warning("%s", err); + return 0; + } + +diff --git a/raster/r.in.ascii/gethead.c b/raster/r.in.ascii/gethead.c +index 086670d..ea8e610 100644 +--- a/raster/r.in.ascii/gethead.c ++++ b/raster/r.in.ascii/gethead.c +@@ -221,7 +221,7 @@ int gethead(FILE * fd, + } + + if ((err = G_adjust_Cell_head(cellhd, 1, 1))) { +- G_warning(err); ++ G_warning("%s", err); + return 0; + } + +diff --git a/raster/r.in.gdal/main.c b/raster/r.in.gdal/main.c +index 81ba40c..62fedb7 100644 +--- a/raster/r.in.gdal/main.c ++++ b/raster/r.in.gdal/main.c +@@ -443,7 +443,7 @@ int main(int argc, char *argv[]) + 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 @@ static void SetupReprojector(const char *pszSrcWKT, const char *pszDstLoc, + 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 */ +diff --git a/raster/r.in.mat/main.c b/raster/r.in.mat/main.c +index 4b7da0f..1927924 100644 +--- a/raster/r.in.mat/main.c ++++ b/raster/r.in.mat/main.c +@@ -407,10 +407,10 @@ int main(int argc, char *argv[]) + region.zone = G_zone(); + buff = G_adjust_Cell_head(®ion, 1, 1); + if (buff) +- G_fatal_error(buff); ++ G_fatal_error("%s", buff); + G_set_window(®ion); + +- 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/raster/r.in.xyz/main.c b/raster/r.in.xyz/main.c +index 527ea3b..a2fc1f0 100644 +--- a/raster/r.in.xyz/main.c ++++ b/raster/r.in.xyz/main.c +@@ -1059,7 +1059,7 @@ int main(int argc, char *argv[]) + + + 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); +diff --git a/raster/r.le/r.le.patch/driver.c b/raster/r.le/r.le.patch/driver.c +index 32d26ae..db368bd 100644 +--- a/raster/r.le/r.le.patch/driver.c ++++ b/raster/r.le/r.le.patch/driver.c +@@ -2565,12 +2565,9 @@ void read_line(char *name, int line, int n, int *value, int *fvalue, + } + } + 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); +diff --git a/raster/r.out.vrml/main.c b/raster/r.out.vrml/main.c +index 8bb9470..5d60635 100644 +--- a/raster/r.out.vrml/main.c ++++ b/raster/r.out.vrml/main.c +@@ -34,7 +34,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + } + 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 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + /* 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); + } + } + +diff --git a/raster/r.profile/main.c b/raster/r.profile/main.c +index 167c1cd..e107279 100644 +--- a/raster/r.profile/main.c ++++ b/raster/r.profile/main.c +@@ -181,7 +181,7 @@ int main(int argc, char *argv[]) + 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) { +diff --git a/raster/r.profile/read_rast.c b/raster/r.profile/read_rast.c +index 0892002..5b77f6a 100644 +--- a/raster/r.profile/read_rast.c ++++ b/raster/r.profile/read_rast.c +@@ -46,7 +46,7 @@ int read_rast(double east, double north, double dist, int fd, int coords, + 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 @@ int read_rast(double east, double north, double dist, int fd, int coords, + 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 @@ int read_rast(double east, double north, double dist, int fd, int coords, + 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]); + +diff --git a/raster/r.quant/main.c b/raster/r.quant/main.c +index f648d6f..80d6038 100644 +--- a/raster/r.quant/main.c ++++ b/raster/r.quant/main.c +@@ -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 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + { + 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); + } + } + +diff --git a/raster/r.quant/read_rules.c b/raster/r.quant/read_rules.c +index 82a6779..0c38c0a 100644 +--- a/raster/r.quant/read_rules.c ++++ b/raster/r.quant/read_rules.c +@@ -12,20 +12,17 @@ int read_range(void) + 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)) +diff --git a/raster/r.random.surface/init.c b/raster/r.random.surface/init.c +index b4fdbae..955ac11 100644 +--- a/raster/r.random.surface/init.c ++++ b/raster/r.random.surface/init.c +@@ -207,7 +207,7 @@ void Init(int argc, char **argv) + 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 @@ void Init(int argc, char **argv) + 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 */ +diff --git a/raster/r.reclass/main.c b/raster/r.reclass/main.c +index dcbcd0c..362b937 100644 +--- a/raster/r.reclass/main.c ++++ b/raster/r.reclass/main.c +@@ -124,7 +124,7 @@ int main(int argc, char *argv[]) + } + else { + strcat(buf, _(" - invalid reclass rule")); +- G_fatal_error(buf); ++ G_fatal_error("%s", buf); + } + break; + +diff --git a/raster/r.resamp.rst/main.c b/raster/r.resamp.rst/main.c +index e84965b..5032d38 100644 +--- a/raster/r.resamp.rst/main.c ++++ b/raster/r.resamp.rst/main.c +@@ -718,5 +718,5 @@ void clean_fatal_error(char *str) + fclose(Tmp_fd_xy); + unlink(Tmp_file_xy); + } +- G_fatal_error(str); ++ G_fatal_error("%s", str); + } +diff --git a/raster/r.rescale.eq/main.c b/raster/r.rescale.eq/main.c +index 2b0ebd2..52998fa 100644 +--- a/raster/r.rescale.eq/main.c ++++ b/raster/r.rescale.eq/main.c +@@ -115,11 +115,11 @@ int main(int argc, char *argv[]) + 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); +diff --git a/raster/r.rescale/main.c b/raster/r.rescale/main.c +index ef1113f..1e9469f 100644 +--- a/raster/r.rescale/main.c ++++ b/raster/r.rescale/main.c +@@ -110,11 +110,11 @@ int main(int argc, char *argv[]) + 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) { +diff --git a/raster/r.surf.contour/bseg_get.c b/raster/r.surf.contour/bseg_get.c +index c70902a..0bb4b6f 100644 +--- a/raster/r.surf.contour/bseg_get.c ++++ b/raster/r.surf.contour/bseg_get.c +@@ -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); +diff --git a/raster/r.surf.contour/bseg_put.c b/raster/r.surf.contour/bseg_put.c +index 31010d8..036363f 100644 +--- a/raster/r.surf.contour/bseg_put.c ++++ b/raster/r.surf.contour/bseg_put.c +@@ -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 @@ int bseg_put(BSEG * bseg, char * value, int row, int col) + 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; +diff --git a/raster/r.surf.contour/bseg_read.c b/raster/r.surf.contour/bseg_read.c +index 8fbf4c2..a2df0ef 100644 +--- a/raster/r.surf.contour/bseg_read.c ++++ b/raster/r.surf.contour/bseg_read.c +@@ -9,7 +9,6 @@ int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset) + int row, nrows; + int col, ncols; + int map_fd; +- char msg[100]; + CELL *buffer; + char value; + +@@ -18,9 +17,8 @@ int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset) + + 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 @@ int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset) + 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--) { +diff --git a/raster/r.surf.contour/dseg_read.c b/raster/r.surf.contour/dseg_read.c +index af5362d..83ccaa1 100644 +--- a/raster/r.surf.contour/dseg_read.c ++++ b/raster/r.surf.contour/dseg_read.c +@@ -8,16 +8,14 @@ int dseg_read_cell(DSEG * dseg, char *map_name, char *mapset) + { + int row, nrows; + int map_fd; +- char msg[100]; + DCELL *buffer; + + dseg->name = NULL; + 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 @@ int dseg_read_cell(DSEG * dseg, char *map_name, char *mapset) + 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); + } + } +diff --git a/raster/r.surf.contour/dseg_write.c b/raster/r.surf.contour/dseg_write.c +index 126e65e..0a369dd 100644 +--- a/raster/r.surf.contour/dseg_write.c ++++ b/raster/r.surf.contour/dseg_write.c +@@ -7,13 +7,11 @@ int dseg_write_cellfile(DSEG * dseg, char *map_name) + { + 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 @@ int dseg_write_cellfile(DSEG * dseg, char *map_name) + 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; + } + } +diff --git a/raster/r.to.rast3/main.c b/raster/r.to.rast3/main.c +index a36f086..f47835a 100644 +--- a/raster/r.to.rast3/main.c ++++ b/raster/r.to.rast3/main.c +@@ -63,7 +63,7 @@ void fatal_error(void *map, int *fd, int depths, char *errorMsg) + close_input_raster_map(fd[i]); + } + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + exit(EXIT_FAILURE); + + } +@@ -205,7 +205,7 @@ int main(int argc, char *argv[]) + + /*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 @@ int main(int argc, char *argv[]) + + /* 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; + +diff --git a/raster/r.to.rast3elev/main.c b/raster/r.to.rast3elev/main.c +index 340460b..8b52489 100644 +--- a/raster/r.to.rast3elev/main.c ++++ b/raster/r.to.rast3elev/main.c +@@ -189,7 +189,7 @@ void fatal_error(Database db, char *errorMsg) + if (db.elev) + close_input_raster_map(db.elev); + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + exit(EXIT_FAILURE); + } + +diff --git a/raster/r.to.vect/areas_io.c b/raster/r.to.vect/areas_io.c +index 9677ea7..d68a5fa 100644 +--- a/raster/r.to.vect/areas_io.c ++++ b/raster/r.to.vect/areas_io.c +@@ -365,7 +365,7 @@ int write_area(struct area_table *a_list, /* list of areas */ + } + + 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"), +diff --git a/raster/r.to.vect/main.c b/raster/r.to.vect/main.c +index 556d977..d849d29 100644 +--- a/raster/r.to.vect/main.c ++++ b/raster/r.to.vect/main.c +@@ -189,7 +189,7 @@ int main(int argc, char *argv[]) + + 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 @@ int main(int argc, char *argv[]) + 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"), +diff --git a/raster/r.to.vect/util.c b/raster/r.to.vect/util.c +index dfdff50..d537104 100644 +--- a/raster/r.to.vect/util.c ++++ b/raster/r.to.vect/util.c +@@ -150,7 +150,7 @@ void insert_value(int cat, int val, double dval) + + 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)); +diff --git a/raster/r.volume/main.c b/raster/r.volume/main.c +index 1d2fe73..ab739e6 100644 +--- a/raster/r.volume/main.c ++++ b/raster/r.volume/main.c +@@ -183,7 +183,7 @@ int main(int argc, char *argv[]) + "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 */ +diff --git a/raster/r.water.outlet/legal.c b/raster/r.water.outlet/legal.c +index 3615668..0a97bd9 100644 +--- a/raster/r.water.outlet/legal.c ++++ b/raster/r.water.outlet/legal.c +@@ -8,7 +8,7 @@ int do_legal(char *file_name) + + 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 @@ char *do_exist(char *file_name) + 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); + } +diff --git a/raster/r.water.outlet/main.c b/raster/r.water.outlet/main.c +index 5d74772..4fab739 100644 +--- a/raster/r.water.outlet/main.c ++++ b/raster/r.water.outlet/main.c +@@ -83,7 +83,7 @@ int main(int argc, char *argv[]) + + 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); +diff --git a/raster/r.watershed/seg/bseg_read.c b/raster/r.watershed/seg/bseg_read.c +index 9c0b0f9..f507931 100644 +--- a/raster/r.watershed/seg/bseg_read.c ++++ b/raster/r.watershed/seg/bseg_read.c +@@ -9,7 +9,6 @@ int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset) + int row, nrows; + int col, ncols; + int map_fd; +- char msg[100]; + CELL *buffer; + + bseg->name = NULL; +@@ -17,9 +16,8 @@ int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset) + + 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 @@ int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset) + 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--) { +diff --git a/raster/r.watershed/seg/cseg_read.c b/raster/r.watershed/seg/cseg_read.c +index 14e5f27..3f25a95 100644 +--- a/raster/r.watershed/seg/cseg_read.c ++++ b/raster/r.watershed/seg/cseg_read.c +@@ -8,7 +8,6 @@ int cseg_read_cell(CSEG * cseg, char *map_name, char *mapset) + { + int row, nrows; + int map_fd; +- char msg[100]; + CELL *buffer; + + cseg->name = NULL; +@@ -16,9 +15,8 @@ int cseg_read_cell(CSEG * cseg, char *map_name, char *mapset) + + 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 @@ int cseg_read_cell(CSEG * cseg, char *map_name, char *mapset) + 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); + } + } +diff --git a/raster/r.watershed/seg/dseg_read.c b/raster/r.watershed/seg/dseg_read.c +index 4d5cd51..f7ab151 100644 +--- a/raster/r.watershed/seg/dseg_read.c ++++ b/raster/r.watershed/seg/dseg_read.c +@@ -8,7 +8,6 @@ int dseg_read_cell(DSEG * dseg, char *map_name, char *mapset) + { + int row, nrows, ncols; + int map_fd; +- char msg[100]; + double *dbuffer; + + dseg->name = NULL; +@@ -16,9 +15,8 @@ int dseg_read_cell(DSEG * dseg, char *map_name, char *mapset) + + 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 @@ int dseg_read_cell(DSEG * dseg, char *map_name, char *mapset) + 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); + } + } +diff --git a/raster/r.what/die.c b/raster/r.what/die.c +index f22e45c..5c253de 100644 +--- a/raster/r.what/die.c ++++ b/raster/r.what/die.c +@@ -6,7 +6,7 @@ void die(char *a, char *b) + char *message; + + G_asprintf(&message, "%s: %s %s", G_program_name(), a, b); +- G_fatal_error(message); ++ G_fatal_error("%s", message); + + return; + } +diff --git a/raster/wildfire/r.spread/collect_ori.c b/raster/wildfire/r.spread/collect_ori.c +index fe2eaa3..e958410 100644 +--- a/raster/wildfire/r.spread/collect_ori.c ++++ b/raster/wildfire/r.spread/collect_ori.c +@@ -48,7 +48,6 @@ void collect_ori(int start_fd) + 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 @@ void collect_ori(int start_fd) + 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; + } + +diff --git a/raster3d/r3.cross.rast/main.c b/raster3d/r3.cross.rast/main.c +index 4fbf50c..b027c04 100644 +--- a/raster3d/r3.cross.rast/main.c ++++ b/raster3d/r3.cross.rast/main.c +@@ -62,7 +62,7 @@ void fatal_error(void *map, int elevfd, int outfd, char *errorMsg) + if (elevfd != -1) + close_output_map(elevfd); + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + exit(EXIT_FAILURE); + + } +diff --git a/raster3d/r3.in.ascii/main.c b/raster3d/r3.in.ascii/main.c +index 1b959e1..924c342 100644 +--- a/raster3d/r3.in.ascii/main.c ++++ b/raster3d/r3.in.ascii/main.c +@@ -56,7 +56,7 @@ static void fatalError(char *errorMsg) + G3d_closeCell(map); + } + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + } + + /*---------------------------------------------------------------------------*/ +diff --git a/raster3d/r3.in.v5d/main.c b/raster3d/r3.in.v5d/main.c +index 827c199..4867b65 100644 +--- a/raster3d/r3.in.v5d/main.c ++++ b/raster3d/r3.in.v5d/main.c +@@ -46,7 +46,7 @@ static void fatalError(char *errorMsg) + /* should unopen map here! */ + } + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + } + + /*---------------------------------------------------------------------------*/ +diff --git a/raster3d/r3.out.ascii/main.c b/raster3d/r3.out.ascii/main.c +index 1059cde..8181348 100644 +--- a/raster3d/r3.out.ascii/main.c ++++ b/raster3d/r3.out.ascii/main.c +@@ -59,7 +59,7 @@ void fatalError(char *errorMsg) + + } + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + } + + /*---------------------------------------------------------------------------*/ +diff --git a/raster3d/r3.out.v5d/main.c b/raster3d/r3.out.v5d/main.c +index 96cb985..ec8b0d5 100644 +--- a/raster3d/r3.out.v5d/main.c ++++ b/raster3d/r3.out.v5d/main.c +@@ -54,7 +54,7 @@ void fatalError(char *errorMsg) + fatalError(_("Unable to close 3D raster map")); + } + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + } + + /*---------------------------------------------------------------------------*/ +diff --git a/raster3d/r3.to.rast/main.c b/raster3d/r3.to.rast/main.c +index 7f794ed..b7712df 100644 +--- a/raster3d/r3.to.rast/main.c ++++ b/raster3d/r3.to.rast/main.c +@@ -60,7 +60,7 @@ void fatal_error(void *map, int *fd, int depths, char *errorMsg) + G_unopen_cell(fd[i]); + } + +- G3d_fatalError(errorMsg); ++ G3d_fatalError("%s", errorMsg); + exit(EXIT_FAILURE); + + } +diff --git a/vector/v.convert/att.c b/vector/v.convert/att.c +index 36acbd7..db442f6 100644 +--- a/vector/v.convert/att.c ++++ b/vector/v.convert/att.c +@@ -60,7 +60,7 @@ int attributes(char *in, struct Map_info *Out) + 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 @@ int attributes(char *in, struct Map_info *Out) + 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); +diff --git a/vector/v.in.ascii/in.c b/vector/v.in.ascii/in.c +index d7bbe5d..21f506e 100644 +--- a/vector/v.in.ascii/in.c ++++ b/vector/v.in.ascii/in.c +@@ -380,7 +380,7 @@ int main(int argc, char *argv[]) + 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"), +diff --git a/vector/v.in.ascii/points.c b/vector/v.in.ascii/points.c +index 02ee5e4..ef0e47c 100644 +--- a/vector/v.in.ascii/points.c ++++ b/vector/v.in.ascii/points.c +@@ -399,7 +399,7 @@ int points_to_bin(FILE * ascii, int rowlen, struct Map_info *Map, + 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"), +diff --git a/vector/v.in.dwg/entity.c b/vector/v.in.dwg/entity.c +index 0311113..203d6d6 100644 +--- a/vector/v.in.dwg/entity.c ++++ b/vector/v.in.dwg/entity.c +@@ -262,7 +262,7 @@ int write_line(PAD_ENT_HDR adenhd, int type, int level) + 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); +diff --git a/vector/v.in.dwg/main.c b/vector/v.in.dwg/main.c +index bb7cc63..abde533 100644 +--- a/vector/v.in.dwg/main.c ++++ b/vector/v.in.dwg/main.c +@@ -121,7 +121,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/vector/v.in.ogr/main.c b/vector/v.in.ogr/main.c +index d0d558e..e5b409f 100644 +--- a/vector/v.in.ogr/main.c ++++ b/vector/v.in.ogr/main.c +@@ -595,7 +595,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/vector/v.in.sites/main.c b/vector/v.in.sites/main.c +index 4162c06..66ff3f6 100644 +--- a/vector/v.in.sites/main.c ++++ b/vector/v.in.sites/main.c +@@ -151,7 +151,7 @@ int main(int argc, char *argv[]) + } + 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 @@ int main(int argc, char *argv[]) + + 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); +diff --git a/vector/v.net.allpairs/main.c b/vector/v.net.allpairs/main.c +index a92fc96..3d3636b 100644 +--- a/vector/v.net.allpairs/main.c ++++ b/vector/v.net.allpairs/main.c +@@ -146,7 +146,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/vector/v.net.centrality/main.c b/vector/v.net.centrality/main.c +index d5b2fad..79c8629 100644 +--- a/vector/v.net.centrality/main.c ++++ b/vector/v.net.centrality/main.c +@@ -233,7 +233,7 @@ int main(int argc, char *argv[]) + "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); +diff --git a/vector/v.net.components/main.c b/vector/v.net.components/main.c +index 6503baa..c8193ef 100644 +--- a/vector/v.net.components/main.c ++++ b/vector/v.net.components/main.c +@@ -31,7 +31,7 @@ int insert_new_record(dbDriver * driver, struct field_info *Fi, + + 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/vector/v.net.distance/main.c b/vector/v.net.distance/main.c +index cb2a639..4af3e04 100644 +--- a/vector/v.net.distance/main.c ++++ b/vector/v.net.distance/main.c +@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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"), +diff --git a/vector/v.net.flow/main.c b/vector/v.net.flow/main.c +index d4ea47e..662bba1 100644 +--- a/vector/v.net.flow/main.c ++++ b/vector/v.net.flow/main.c +@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/vector/v.net.path/path.c b/vector/v.net.path/path.c +index 321e4ad..8cec95f 100644 +--- a/vector/v.net.path/path.c ++++ b/vector/v.net.path/path.c +@@ -102,7 +102,7 @@ int path(struct Map_info *In, struct Map_info *Out, char *filename, + 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 @@ int path(struct Map_info *In, struct Map_info *Out, char *filename, + "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); +diff --git a/vector/v.net.timetable/main.c b/vector/v.net.timetable/main.c +index dc5acdc..f979c2f 100644 +--- a/vector/v.net.timetable/main.c ++++ b/vector/v.net.timetable/main.c +@@ -96,7 +96,7 @@ void init_database(struct Map_info *Out, dbDriver ** driver, + 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 @@ void insert_point(dbDriver * driver, char *table, int cat, int path, + 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 @@ void insert_line(dbDriver * driver, char *table, int cat, int path, + 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)); +diff --git a/vector/v.overlay/area_area.c b/vector/v.overlay/area_area.c +index e8f4382..da6f02f 100644 +--- a/vector/v.overlay/area_area.c ++++ b/vector/v.overlay/area_area.c +@@ -339,7 +339,7 @@ int area_area(struct Map_info *In, int *field, struct Map_info *Out, + + 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'"), +diff --git a/vector/v.overlay/line_area.c b/vector/v.overlay/line_area.c +index 3b35138..92e0560 100644 +--- a/vector/v.overlay/line_area.c ++++ b/vector/v.overlay/line_area.c +@@ -212,7 +212,7 @@ int line_area(struct Map_info *In, int *field, struct Map_info *Out, + + 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'"), +diff --git a/vector/v.overlay/main.c b/vector/v.overlay/main.c +index ea87580..a6ab830 100644 +--- a/vector/v.overlay/main.c ++++ b/vector/v.overlay/main.c +@@ -517,7 +517,7 @@ int main(int argc, char *argv[]) + + 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); +diff --git a/vector/v.random/main.c b/vector/v.random/main.c +index e68ffbd..08b38ac 100644 +--- a/vector/v.random/main.c ++++ b/vector/v.random/main.c +@@ -185,7 +185,7 @@ int main(int argc, char *argv[]) + 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 @@ int main(int argc, char *argv[]) + 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); +diff --git a/vector/v.surf.rst/main.c b/vector/v.surf.rst/main.c +index 88dfdd0..a21db40 100644 +--- a/vector/v.surf.rst/main.c ++++ b/vector/v.surf.rst/main.c +@@ -601,7 +601,7 @@ int main(int argc, char *argv[]) + 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 @@ void clean_fatal_error(char *str) + fclose(Tmp_fd_xy); + unlink(Tmp_file_xy); + } +- G_fatal_error(str); ++ G_fatal_error("%s", str); + } +diff --git a/vector/v.vol.rst/main.c b/vector/v.vol.rst/main.c +index 2d25b4e..ff7cc5e 100644 +--- a/vector/v.vol.rst/main.c ++++ b/vector/v.vol.rst/main.c +@@ -584,7 +584,7 @@ int main(int argc, char *argv[]) + 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>"), +diff --git a/vector/v.vol.rst/user4.c b/vector/v.vol.rst/user4.c +index 3ff3fbf..8067f44 100644 +--- a/vector/v.vol.rst/user4.c ++++ b/vector/v.vol.rst/user4.c +@@ -74,7 +74,7 @@ void clean_fatal_error(char *str) + fclose(Tmp_fd_xy); + unlink(Tmp_file_xy); + } +- G_fatal_error(str); ++ G_fatal_error("%s", str); + } + + +diff --git a/vector/v.vol.rst/vector.c b/vector/v.vol.rst/vector.c +index fb3efed..16b0965 100644 +--- a/vector/v.vol.rst/vector.c ++++ b/vector/v.vol.rst/vector.c +@@ -72,7 +72,7 @@ int point_save(double xmm, double ymm, double zmm, double err) + 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); +diff --git a/vector/v.what.rast/main.c b/vector/v.what.rast/main.c +index 189bbac..a668191 100644 +--- a/vector/v.what.rast/main.c ++++ b/vector/v.what.rast/main.c +@@ -178,7 +178,7 @@ int main(int argc, char *argv[]) + + 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 @@ int main(int argc, char *argv[]) + 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) { +-- +1.9.3 + diff --git a/grass.spec b/grass.spec index 370cbba..b7f7a7f 100644 --- a/grass.spec +++ b/grass.spec @@ -25,7 +25,7 @@ Name: grass Version: 6.4.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: GRASS - Geographic Resources Analysis Support System Group: Applications/Engineering License: GPLv2+ @@ -39,6 +39,9 @@ Patch1: 0002-grass-shlib-soname.patch Patch2: 0003-grass-docfiles.patch +# Address -Werror-format-string-security issues. +Patch3: 0004-Eliminate-Werror-format-string-security-issues.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: proj-nad proj-epsg wxPython @@ -128,6 +131,7 @@ GRASS (Geographic Resources Analysis Support System) development headers. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 # Correct mysql_config query sed -i 's|--libmysqld-libs|--libs|g' configure @@ -146,9 +150,6 @@ sed -i -e 's|\r||g' gui/icons/%{name}/vdigit/box.xbm #TODO: Necessary? export INSTALL="%{__install} -c -p" -# Package is not ready for -Werror=format-security -CFLAGS="$(echo ${RPM_OPT_FLAGS} | sed -e 's,-Werror=format-security,-Wformat-security,')" \ -CXXFLAGS="$(echo ${RPM_OPT_FLAGS} | sed -e 's,-Werror=format-security,-Wformat-security,')" \ %configure \ --enable-largefile \ --enable-shared \ @@ -365,12 +366,16 @@ fi %changelog -* Sat Aug 09 2014 Ralf Corsépius 6.4.4-2 +* Sun Aug 10 2014 Ralf Corsépius - 6.4.4-3 +- Add 0004-Eliminate-Werror-format-string-security-issues.patch (RHBZ#1037102) +- Re-enable building w/ -Werror=format-security. + +* Sat Aug 09 2014 Ralf Corsépius - 6.4.4-2 - Rebase patches against grass-6.4.4. - Convert -Werror=format-security into warnings (RHBZ#1106720). - Minor spec cleanup. -* Fri Jul 25 2014 Peter Robinson 6.4.4-1 +* Fri Jul 25 2014 Peter Robinson - 6.4.4-1 - Update to 6.4.4 - Make 64bit conditionals generic