diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-08-12 16:51:01 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-08-12 16:51:01 +0900 |
| commit | 285ce9d8aa9ecfd7b749ae02784a2ba68290293a (patch) | |
| tree | 8ab824fba28984e4bb863661c24833c1692c8047 /src/string.c | |
| parent | 472dba19ea13e8403667f530ce40e16dcd1bdee1 (diff) | |
| download | mruby-285ce9d8aa9ecfd7b749ae02784a2ba68290293a.tar.gz mruby-285ce9d8aa9ecfd7b749ae02784a2ba68290293a.zip | |
Replacing region may overwrap with the target region; fix #4627
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c index 0abc07000..1d2f0dec0 100644 --- a/src/string.c +++ b/src/string.c @@ -1264,7 +1264,7 @@ str_replace_partial(mrb_state *mrb, mrb_value src, mrb_int pos, mrb_int end, mrb memmove(strp + newlen - (len - end), strp + end, len - end); if (!mrb_nil_p(rep)) { - memcpy(strp + pos, RSTRING_PTR(rep), replen); + memmove(strp + pos, RSTRING_PTR(rep), replen); } RSTR_SET_LEN(str, newlen); strp[newlen] = '\0'; |
