aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--vsnprintf.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d357f7fa71..fa08155a9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jan 19 02:54:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (cvt): set first byte of buf to NUL for the case when
+ no bytes are written to the buf. [ruby-dev:43062]
+
Tue Jan 18 23:04:51 2011 Tanaka Akira <akr@fsij.org>
* gc.h: parenthesize macro arguments.
diff --git a/vsnprintf.c b/vsnprintf.c
index 7c4d4a9749..79bde9f485 100644
--- a/vsnprintf.c
+++ b/vsnprintf.c
@@ -1197,6 +1197,7 @@ cvt(value, ndigits, flags, sign, decpt, ch, length, buf)
else {
digits = BSD__dtoa(value, mode, ndigits, decpt, &dsgn, &rve);
}
+ buf[0] = 0; /* rve - digits may be 0 */
memcpy(buf, digits, rve - digits);
xfree(digits);
rve = buf + (rve - digits);