Add NUL always to short strings; ref 98fc887

This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-08-11 21:53:23 +09:00
parent ce7fd7e1a3
commit 70b53f91c2
+1
View File
@@ -594,6 +594,7 @@ str_replace(mrb_state *mrb, struct RString *s1, struct RString *s2)
RSTR_SET_EMBED_FLAG(s1);
memcpy(s1->as.ary, RSTR_PTR(s2), len);
RSTR_SET_EMBED_LEN(s1, len);
RSTR_PTR(s1)[len] = '\0';
}
else {
str_make_shared(mrb, s2, s1);