diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | string.c | 3 |
2 files changed, 7 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Wed Sep 13 16:43:36 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * string.c (rb_str_intern): prohibit interning tainted string. + Wed Sep 13 01:14:02 2006 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/optparse.rb (OptionParser#getopts): works with pre-registered @@ -4153,6 +4153,9 @@ rb_str_intern(VALUE s) } if (strlen(RSTRING_PTR(str)) != RSTRING_LEN(str)) rb_raise(rb_eArgError, "symbol string may not contain `\\0'"); + if (OBJ_TAINTED(str)) { + rb_raise(rb_eSecurityError, "Insecure: can't intern tainted string"); + } id = rb_intern(RSTRING_PTR(str)); return ID2SYM(id); } |