[GRASS-SVN] r52883 - grass/branches/releasebranch_6_4/display/d.profile
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 25 03:29:49 PDT 2012
Author: mmetz
Date: 2012-08-25 03:29:49 -0700 (Sat, 25 Aug 2012)
New Revision: 52883
Modified:
grass/branches/releasebranch_6_4/display/d.profile/Range.c
Log:
hamish: avoid out-of-bounds buffer access (#1312)
Modified: grass/branches/releasebranch_6_4/display/d.profile/Range.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.profile/Range.c 2012-08-25 10:09:05 UTC (rev 52882)
+++ grass/branches/releasebranch_6_4/display/d.profile/Range.c 2012-08-25 10:29:49 UTC (rev 52883)
@@ -7,7 +7,7 @@
{
char inbuf[512]; /* input buffer for reading stats */
int done = 0;
- char stats_cmd[512]; /* string for r.stats command */
+ char stats_cmd[GPATH_MAX]; /* string for r.stats command */
char *temp_fname; /* temp file name */
FILE *temp_file; /* temp file pointer */
long int cat; /* a category value */
@@ -24,7 +24,7 @@
first = 1;
while (!done) {
- if (fgets(inbuf, 1024, temp_file) != NULL) {
+ if (fgets(inbuf, sizeof(inbuf), temp_file) != NULL) {
if (sscanf(inbuf, "%ld %ld", &cat, &stat) == 2) {
if (first) {
*max = cat;
More information about the grass-commit
mailing list