aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-04 12:23:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-04 12:23:57 +0000
commit561fe11035955f0759501442519462b0141f25ed (patch)
tree57136b2df6f74cd2b22f9ba7c6bdddf34dcb6eee /re.c
parent161a0df79741da19ed0abe7b7e532da4d567411e (diff)
downloadruby-561fe11035955f0759501442519462b0141f25ed.tar.gz
re.c: fix name with NUL
* re.c (match_aref): should not ignore name after NUL byte. [ruby-dev:48275] [Bug #9902] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/re.c b/re.c
index 89910f67b4..dff95b7942 100644
--- a/re.c
+++ b/re.c
@@ -1796,17 +1796,13 @@ match_aref(int argc, VALUE *argv, VALUE match)
switch (TYPE(idx)) {
case T_SYMBOL:
- p = rb_id2name(SYM2ID(idx));
- goto name_to_backref;
- break;
+ idx = rb_sym2str(idx);
+ /* fall through */
case T_STRING:
p = StringValuePtr(idx);
-
- name_to_backref:
num = name_to_backref_number(RMATCH_REGS(match),
- RMATCH(match)->regexp, p, p + strlen(p));
+ RMATCH(match)->regexp, p, p + RSTRING_LEN(idx));
return rb_reg_nth_match(num, match);
- break;
default:
break;