summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-31 02:06:23 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-31 02:06:23 +0000
commitd0932798885381b1160614cdc2562a084f043d67 (patch)
treed59240216be785e7f662288bd8a5905e81f272a3 /hash.c
parent5bfef93c44f00eb7028520e8437e0f957e3cd3b0 (diff)
* hash.c (env_reject_bang): untaint key string.
* hash.c (env_delete_m): execute block only if deleting key does not exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 1bb4c93..a2fa1fd 100644
--- a/hash.c
+++ b/hash.c
@@ -1002,8 +1002,10 @@ static VALUE
env_delete_m(obj, name)
VALUE obj, name;
{
- VALUE val = env_delete(obj, name);
- if (rb_block_given_p()) rb_yield(name);
+ VALUE val;
+
+ val = env_delete(obj, name);
+ if (NIL_P(val) && rb_block_given_p()) rb_yield(name);
return val;
}
@@ -1342,6 +1344,7 @@ env_reject_bang()
VALUE val = rb_f_getenv(Qnil, *ptr);
if (!NIL_P(val)) {
if (RTEST(rb_yield(rb_assoc_new(*ptr, val)))) {
+ FL_UNSET(*ptr, FL_TAINT);
env_delete(Qnil, *ptr);
del++;
}