summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-08-11 21:53:23 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-08-11 22:14:56 +0900
commit70b53f91c258e23fc5d68dd8f9c7cf5b8e0290f6 (patch)
tree1de4e45abfb5cba716b285773692deb9dcc2c58d /src/string.c
parentce7fd7e1a34adfac6974caf3f09ef5899f8a7670 (diff)
downloadmruby-70b53f91c258e23fc5d68dd8f9c7cf5b8e0290f6.tar.gz
mruby-70b53f91c258e23fc5d68dd8f9c7cf5b8e0290f6.zip
Add `NUL` always to short strings; ref 98fc887
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index daf293368..0abc07000 100644
--- a/src/string.c
+++ b/src/string.c
@@ -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);