aboutsummaryrefslogtreecommitdiffstats
path: root/vsnprintf.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-18 17:56:10 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-18 17:56:10 +0000
commitb680cd7d05b31be0d458b05232b86bb36f1296a0 (patch)
tree5c132f3b5c6ad19c9beabbbc0a22008952fc69e8 /vsnprintf.c
parent0858cbf3fd16ee839810e059b8ab46ead00515d4 (diff)
downloadruby-b680cd7d05b31be0d458b05232b86bb36f1296a0.tar.gz
* vsnprintf.c (cvt): set first byte of buf to NUL for the case when
no bytes are written to the buf. [ruby-dev:43062] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vsnprintf.c')
-rw-r--r--vsnprintf.c1
1 files changed, 1 insertions, 0 deletions
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);