summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/re.c b/re.c
index 90999a9572..5663f02919 100644
--- a/re.c
+++ b/re.c
@@ -1205,6 +1205,9 @@ rb_reg_quote(str)
meta_found:
tmp = rb_str_new(0, RSTRING(str)->len*2);
t = RSTRING(tmp)->ptr;
+ /* copy upto metacharacter */
+ memcpy(t, RSTRING(str)->ptr, s - RSTRING(str)->ptr);
+ t += s - RSTRING(str)->ptr;
for (; s < send; s++) {
c = *s;