[GRASS-SVN] r50185 - grass/trunk/raster/r.support

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 14 19:39:55 EST 2012


Author: hamish
Date: 2012-01-14 16:39:55 -0800 (Sat, 14 Jan 2012)
New Revision: 50185

Modified:
   grass/trunk/raster/r.support/main.c
Log:
avoid buffer overflow

Modified: grass/trunk/raster/r.support/main.c
===================================================================
--- grass/trunk/raster/r.support/main.c	2012-01-15 00:30:45 UTC (rev 50184)
+++ grass/trunk/raster/r.support/main.c	2012-01-15 00:39:55 UTC (rev 50185)
@@ -152,7 +152,7 @@
 
     if (title_opt->answer) {
 	strncpy(title, title_opt->answer, MAX_TITLE_LEN);
-	title[MAX_TITLE_LEN] = '\0';	/* strncpy doesn't null terminate oversized input */
+	title[MAX_TITLE_LEN - 1] = '\0';	/* strncpy doesn't null terminate oversized input */
 	G_strip(title);
 	G_debug(3, "map title= [%s]  (%d chars)", title, strlen(title));
 	Rast_put_cell_title(raster->answer, title);



More information about the grass-commit mailing list