merges r30595 from trunk into ruby_1_9_2.

--
* 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/branches/ruby_1_9_2@30688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2011-01-28 02:25:18 +00:00
parent baac6078e3
commit aeb3ba1e58
3 changed files with 7 additions and 1 deletions

View file

@ -1165,6 +1165,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);