diff options
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; } |