summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-21 09:20:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-21 09:20:54 +0000
commitec7a338ade8a39f3099f0d78baae52be45cb1b62 (patch)
tree70b7bb8ffc22b0788a94c28f3c041dc35f6a50b9 /variable.c
parent1a4f41f05361505856573a55e64634b065f9d1b9 (diff)
* variable.c (rb_cvar_set): add frozen class/module check.
* variable.c (rb_cvar_declare): add frozen class/module check. * re.c (match_to_a): should propagate taint. * re.c (rb_reg_s_quote): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index f579a677e8..b04fe84b48 100644
--- a/variable.c
+++ b/variable.c
@@ -1379,6 +1379,7 @@ rb_cvar_set(klass, id, val)
tmp = klass;
while (tmp) {
if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,0)) {
+ if (OBJ_FROZEN(tmp)) rb_error_frozen("class/module");
if (!OBJ_TAINTED(tmp) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify class variable");
st_insert(RCLASS(tmp)->iv_tbl,id,val);
@@ -1402,6 +1403,7 @@ rb_cvar_declare(klass, id, val)
tmp = klass;
while (tmp) {
if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,0)) {
+ if (OBJ_FROZEN(tmp)) rb_error_frozen("class/module");
if (!OBJ_TAINTED(tmp) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify class variable");
st_insert(RCLASS(tmp)->iv_tbl,id,val);