* 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
This commit is contained in:
matz 2003-03-31 02:06:23 +00:00
Родитель 5bfef93c44
Коммит d093279888
3 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Mon Mar 31 10:50:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (env_reject_bang): untaint key string.
* hash.c (env_delete_m): execute block only if deleting key does
not exist.
Sat Mar 29 17:54:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* pack.c (pack_pack): do not call rb_str_buf_cat() with NULL ptr,

7
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++;
}

Просмотреть файл

@ -450,11 +450,11 @@ module Benchmark
STDOUT.sync = sync
end
def bm(label_width = 0, *labels, &blk)
benchmark(" "*label_width + CAPTION, label_width, FMTSTR, *labels, &blk)
def bm(label_width = 0, *labels)
benchmark(" "*label_width + CAPTION, label_width, FMTSTR, *labels){|*x|yield *x}
end
def bmbm(width = 0, &blk)
def bmbm(width = 0)
job = Job.new(width)
yield(job)
width = job.width