aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index bb50e5a902..a0e413a267 100644
--- a/string.c
+++ b/string.c
@@ -7188,7 +7188,7 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
len = chompped_length(str, rs);
if (len < olen) {
STR_SET_LEN(str, len);
- RSTRING_PTR(str)[len] = '\0';
+ TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str));
if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
ENC_CODERANGE_CLEAR(str);
}