summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/re.c b/re.c
index 540ae2848d..9452e42116 100644
--- a/re.c
+++ b/re.c
@@ -275,7 +275,9 @@ static VALUE
rb_reg_source(re)
VALUE re;
{
- return rb_str_new(RREGEXP(re)->str,RREGEXP(re)->len);
+ VALUE str = rb_str_new(RREGEXP(re)->str,RREGEXP(re)->len);
+ if (OBJ_TAINTED(re)) OBJ_TAINT(str);
+ return str;
}
static VALUE
@@ -715,7 +717,8 @@ match_to_s(match)
{
VALUE str = rb_reg_last_match(match);
- if (NIL_P(str)) return rb_str_new(0,0);
+ if (NIL_P(str)) str = rb_str_new(0,0);
+ if (OBJ_TAINTED(match)) OBJ_TAINT(str);
return str;
}