From c90479e5d3986a24e5bbf432484d48c4cd2e8d3f Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 2 Feb 2005 14:53:36 +0000 Subject: [PATCH] * ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended part. [ruby-dev:25618] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 ++++++++--- ext/stringio/stringio.c | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa92d960df..f28673cff1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 2 23:52:53 2005 sheepman + + * ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended + part. [ruby-dev:25618] + Wed Feb 2 21:56:01 2005 Kouhei Sutou * lib/rss/rss.rb (RSS::Element#convert): added. @@ -5,11 +10,11 @@ Wed Feb 2 21:56:01 2005 Kouhei Sutou * lib/rss/rss.rb: convert -> need_convert. * lib/rss/1.0.rb: ditto. - + * lib/rss/0.9.rb: ditto. - + * lib/rss/2.0.rb: ditto. - + * lib/rss/trackback.rb: ditto. Tue Feb 1 22:48:48 2005 Masatoshi SEKI diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 7c1e4ba5f9..23ba3dce4d 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -950,10 +950,14 @@ strio_truncate(self, len) { VALUE string = writable(StringIO(self))->string; long l = NUM2LONG(len); + long plen = RSTRING(string)->len; if (l < 0) { error_inval("negative legnth"); } rb_str_resize(string, l); + if (plen < l) { + MEMZERO(RSTRING(string)->ptr + plen, char, l - plen); + } return len; }