summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--util.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9865a5e..0706f6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug 16 19:22:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_hdtoa): fixed buffer overrun. based on a patch
+ from Peter Weldon at [ruby-core:31725].
+
Mon Aug 16 17:44:55 2010 Tanaka Akira <akr@fsij.org>
* common.mk (capi): use -b option for doxygen. It disables stdout
diff --git a/util.c b/util.c
index 97b2d6c..065b2f1 100644
--- a/util.c
+++ b/util.c
@@ -3951,15 +3951,15 @@ ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
if (isinf(d)) { /* FP_INFINITE */
*decpt = INT_MAX;
- return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1));
+ return rv_strdup(INFSTR, rve);
}
else if (isnan(d)) { /* FP_NAN */
*decpt = INT_MAX;
- return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
+ return rv_strdup(NANSTR, rve);
}
else if (d == 0.0) { /* FP_ZERO */
*decpt = 1;
- return (nrv_alloc("0", rve, 1));
+ return rv_strdup("0", rve);
}
else if (dexp_get(u)) { /* FP_NORMAL */
*decpt = dexp_get(u) - DBL_ADJ;