summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-13 07:49:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-13 07:49:54 +0000
commita0cc731f586023953fb69aacfbedd0350ced98f6 (patch)
tree41e8c611bdec3e0087c8f5c9acc02b00a5ba40d2 /string.c
parentd79408b7035ae6ad85e61ba49cd108bed97b5444 (diff)
* string.c (rb_str_intern): prohibit interning tainted string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string.c b/string.c
index 83ac1e4..681614b 100644
--- a/string.c
+++ b/string.c
@@ -4404,6 +4404,9 @@ rb_str_intern(s)
}
if (strlen(RSTRING(str)->ptr) != RSTRING(str)->len)
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(str)->ptr);
return ID2SYM(id);
}