[GRASS-SVN] r55874 - grass/branches/releasebranch_6_4/raster/r.univar2
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 17 23:59:00 PDT 2013
Author: mmetz
Date: 2013-04-17 23:59:00 -0700 (Wed, 17 Apr 2013)
New Revision: 55874
Modified:
grass/branches/releasebranch_6_4/raster/r.univar2/stats.c
Log:
r.univar: fix buffer overflow
Modified: grass/branches/releasebranch_6_4/raster/r.univar2/stats.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.univar2/stats.c 2013-04-18 06:58:35 UTC (rev 55873)
+++ grass/branches/releasebranch_6_4/raster/r.univar2/stats.c 2013-04-18 06:59:00 UTC (rev 55874)
@@ -131,7 +131,7 @@
stdev = sqrt(variance);
var_coef = (stdev / mean) * 100.; /* perhaps stdev/fabs(mean) ? */
- sprintf(sum_str, "%.10f", stats[z].sum);
+ sprintf(sum_str, "%.15g", stats[z].sum);
G_trim_decimal(sum_str);
if (zone_info.n_zones)
@@ -393,11 +393,11 @@
/* coefficient of variance */
fprintf(stdout, "%.15g%s", var_coef, zone_info.sep);
/* sum */
- sprintf(sum_str, "%.10f", stats[z].sum);
+ sprintf(sum_str, "%.15g", stats[z].sum);
G_trim_decimal(sum_str);
fprintf(stdout, "%s%s", sum_str, zone_info.sep);
/* absolute sum */
- sprintf(sum_str, "%.10f", stats[z].sum_abs);
+ sprintf(sum_str, "%.15g", stats[z].sum_abs);
G_trim_decimal(sum_str);
fprintf(stdout, "%s", sum_str);
More information about the grass-commit
mailing list