Sfoglia il codice sorgente

hamish: don't segfault on long map names (https://trac.osgeo.org/grass/ticket/800)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52898 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 anni fa
parent
commit
8fa0b4cabb
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      raster/r.reclass/reclass.c

+ 2 - 2
raster/r.reclass/reclass.c

@@ -208,7 +208,7 @@ int reclass(const char *old_name, const char *old_mapset,
     struct History hist;
     struct History hist;
     int is_reclass;
     int is_reclass;
     FILE *fd;
     FILE *fd;
-    char buf[256];
+    char buf[GNAME_MAX + GMAPSET_MAX];
 
 
     is_reclass = Rast_get_reclass(old_name, old_mapset, &old);
     is_reclass = Rast_get_reclass(old_name, old_mapset, &old);
     if (is_reclass < 0)
     if (is_reclass < 0)
@@ -230,7 +230,7 @@ int reclass(const char *old_name, const char *old_mapset,
 	G_fatal_error(_("Cannot create reclass file of <%s>"), new_name);
 	G_fatal_error(_("Cannot create reclass file of <%s>"), new_name);
 
 
     if (!title) {
     if (!title) {
-	sprintf(buf, "Reclass of %s in %s", new.name, new.mapset);
+	G_snprintf(buf, sizeof(buf), "Reclass of %s in %s", new.name, new.mapset);
 	title = buf;
 	title = buf;
     }
     }