[GRASS-SVN] r72210 - grass/branches/releasebranch_7_4/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 5 05:14:47 PST 2018


Author: mmetz
Date: 2018-02-05 05:14:47 -0800 (Mon, 05 Feb 2018)
New Revision: 72210

Modified:
   grass/branches/releasebranch_7_4/lib/gis/error.c
Log:
libgis: use G_vasprintf() to avoid buffer overflow (backport trunk r72208)

Modified: grass/branches/releasebranch_7_4/lib/gis/error.c
===================================================================
--- grass/branches/releasebranch_7_4/lib/gis/error.c	2018-02-05 12:52:52 UTC (rev 72209)
+++ grass/branches/releasebranch_7_4/lib/gis/error.c	2018-02-05 13:14:47 UTC (rev 72210)
@@ -72,11 +72,12 @@
 
 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);
 }
 
 /*!



More information about the grass-commit mailing list