diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-27 13:05:48 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-27 13:05:48 +0000 |
commit | 20a2b656c2cbaac6585cf8bf7b8b4f37ad7877ba (patch) | |
tree | 9b5852e193960154282ce416a27a4b529f7b298c /string.c | |
parent | f582b224bd4f86efc4230fb9819d0065cdf66a46 (diff) |
* string.c (rb_str_inspect): get rid of adding garbage to short
UTF-8 string. [ruby-dev:39550]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2718,8 +2718,8 @@ rb_str_inspect(str) p = RSTRING(str)->ptr; pend = p + RSTRING(str)->len; while (p < pend) { char c = *p++; - if (ismbchar(c) && p < pend) { - int len = mbclen(c); + int len; + if (ismbchar(c) && p + (len = mbclen(c)) <= pend) { rb_str_buf_cat(result, p - 1, len); p += len - 1; } |