1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2006-09-13 07:49:54 +00:00
parent d79408b703
commit a0cc731f58
3 changed files with 9 additions and 13 deletions

View file

@ -8,6 +8,7 @@
.ext .ext
.git .git
.svn .svn
.pc
.rbconfig.time .rbconfig.time
COPYING.LIB COPYING.LIB
ChangeLog.pre-alpha ChangeLog.pre-alpha
@ -26,32 +27,20 @@ config.h.in
config.log config.log
config.status config.status
configure configure
foo.rb
libruby.so.* libruby.so.*
miniruby miniruby
miniruby.elhash
miniruby.elhash2
miniruby.orig2
miniruby.plhash
miniruby.plhash2
modex.rb
newdate.rb newdate.rb
newver.rb newver.rb
parse.c parse.c
parse.y.try patches
pitest.rb
ppack ppack
preview preview
rbconfig.rb rbconfig.rb
rename2.h
repack repack
riscos riscos
rubicon rubicon
ruby ruby
ruby-man.rd.gz ruby-man.rd.gz
rubyunit
st.c.power
this that
tmp tmp
web web
y.output y.output

View file

@ -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:21 2006 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Sep 13 01:14:21 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser#getopts): works with pre-registered * lib/optparse.rb (OptionParser#getopts): works with pre-registered

View file

@ -4404,6 +4404,9 @@ rb_str_intern(s)
} }
if (strlen(RSTRING(str)->ptr) != RSTRING(str)->len) if (strlen(RSTRING(str)->ptr) != RSTRING(str)->len)
rb_raise(rb_eArgError, "symbol string may not contain `\\0'"); 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); id = rb_intern(RSTRING(str)->ptr);
return ID2SYM(id); return ID2SYM(id);
} }