Browse Source

libgis: use G_vasprintf() to avoid buffer overflow

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72208 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 7 years ago
parent
commit
9b61d2e668
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lib/gis/error.c

+ 3 - 2
lib/gis/error.c

@@ -72,11 +72,12 @@ jmp_buf *G_fatal_longjmp(int enable)
 
 static void vfprint_error(int type, const char *template, va_list ap)
 {
-    char buffer[2000];		/* G_asprintf does not work */
+    char *buffer = NULL;
 
-    vsprintf(buffer, template, ap);
+    G_vasprintf(&buffer, template, ap);
 
     print_error(buffer, type);
+    G_free(buffer);
 }
 
 /*!