[GRASS-SVN] r55835 - grass/branches/releasebranch_6_4/gem
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 16 20:02:55 PDT 2013
Author: hamish
Date: 2013-04-16 20:02:55 -0700 (Tue, 16 Apr 2013)
New Revision: 55835
Modified:
grass/branches/releasebranch_6_4/gem/main.c
Log:
avoid buffer overflow on long command line strings (#1313, merge from devbr6 r50184)
Modified: grass/branches/releasebranch_6_4/gem/main.c
===================================================================
--- grass/branches/releasebranch_6_4/gem/main.c 2013-04-17 00:45:11 UTC (rev 55834)
+++ grass/branches/releasebranch_6_4/gem/main.c 2013-04-17 03:02:55 UTC (rev 55835)
@@ -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