mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sprintf.c (rb_str_format): fix buffer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8f79efe0be
commit
41da4d16b0
2 changed files with 6 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Dec 23 00:16:48 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* sprintf.c (rb_str_format): fix buffer overflow.
|
||||
|
||||
Mon Dec 22 19:31:19 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* common.mk (revision.h): uses tool/file2lastrev.rb to support
|
||||
|
|
|
@ -979,8 +979,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||
if ((flags & FWIDTH) && need < width)
|
||||
need = width;
|
||||
|
||||
CHECK(need);
|
||||
snprintf(&buf[blen], need, "%*s", need, "");
|
||||
CHECK(need + 1);
|
||||
snprintf(&buf[blen], need + 1, "%*s", need, "");
|
||||
if (flags & FMINUS) {
|
||||
if (!isnan(fval) && fval < 0.0)
|
||||
buf[blen++] = '-';
|
||||
|
|
Loading…
Reference in a new issue