diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-02 14:53:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-02 14:53:36 +0000 |
commit | b5a7849e0c41e5451ee39d1e06fab9e8d57ddd21 (patch) | |
tree | c4d13586e064b457b684aa063ebdc7f3fd47feee /ext/stringio | |
parent | a1c2e139f5e40dd4c5c675e4e7a53fd5e91b3678 (diff) | |
download | ruby-b5a7849e0c41e5451ee39d1e06fab9e8d57ddd21.tar.gz ruby-b5a7849e0c41e5451ee39d1e06fab9e8d57ddd21.tar.xz ruby-b5a7849e0c41e5451ee39d1e06fab9e8d57ddd21.zip |
* ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
part. [ruby-dev:25618]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r-- | ext/stringio/stringio.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index b31f1818b..de9612136 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -934,10 +934,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; } |