Browse Source

Avoid segfaults in case the mapset name is larger than 50 chars

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65524 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 10 years ago
parent
commit
e710979cfa
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/manage/do_remove.c

+ 2 - 2
lib/manage/do_remove.c

@@ -97,9 +97,9 @@ int M_do_remove(int n, const char *old)
     }
     }
 
 
     if (G_strcasecmp(list[n].element[0], "cell") == 0) {
     if (G_strcasecmp(list[n].element[0], "cell") == 0) {
-	char colr2[50];
+	char colr2[G_MAX_PATH];
 
 
-	sprintf(colr2, "colr2/%s", G_mapset());
+	G_snprintf(colr2, G_MAX_PATH, "colr2/%s", G_mapset());
 	switch (G_remove(colr2, old)) {
 	switch (G_remove(colr2, old)) {
 	case -1:
 	case -1:
 	    G_warning(_("Unable to remove %s"), colr2);
 	    G_warning(_("Unable to remove %s"), colr2);