[GRASS-SVN] r50184 - grass/branches/develbranch_6/gem
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 14 19:30:45 EST 2012
Author: hamish
Date: 2012-01-14 16:30:45 -0800 (Sat, 14 Jan 2012)
New Revision: 50184
Modified:
grass/branches/develbranch_6/gem/main.c
Log:
avoid buffer overflow on long command line strings (#1313)
Modified: grass/branches/develbranch_6/gem/main.c
===================================================================
--- grass/branches/develbranch_6/gem/main.c 2012-01-15 00:22:48 UTC (rev 50183)
+++ grass/branches/develbranch_6/gem/main.c 2012-01-15 00:30:45 UTC (rev 50184)
@@ -402,7 +402,8 @@
fprintf(stdout, "\033[0m");
tmp = malloc(sizeof(char) * MAXSTR);
- strcpy(invocation, argv[0]);
+ strncpy(invocation, argv[0], MAXSTR);
+ invocation[MAXSTR-1] = '\0';
/* all output should be unbuffered */
setvbuf(stdout, (char *)NULL, _IONBF, 0);
More information about the grass-commit
mailing list