[GRASS-SVN] r55876 - grass/trunk/raster/r.univar
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Apr 18 00:00:21 PDT 2013
Author: mmetz
Date: 2013-04-18 00:00:21 -0700 (Thu, 18 Apr 2013)
New Revision: 55876
Modified:
grass/trunk/raster/r.univar/stats.c
Log:
r.univar: fix buffer overflow
Modified: grass/trunk/raster/r.univar/stats.c
===================================================================
--- grass/trunk/raster/r.univar/stats.c 2013-04-18 06:59:42 UTC (rev 55875)
+++ grass/trunk/raster/r.univar/stats.c 2013-04-18 07:00:21 UTC (rev 55876)
@@ -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) {
@@ -397,11 +397,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