diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-22 10:26:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-22 10:26:40 +0000 |
commit | af1ca4cb132dba91dd88471170d3106d304f0e24 (patch) | |
tree | 822c0c91a493e05f4071fe2b620abfe73319580c /object.c | |
parent | 6a35c26b2dfbd2a516e450e916eb8d13c3ff5ddf (diff) |
object.c: check more strictly
* object.c (rb_mod_const_get): check more strictly. [ruby-dev:46748]
[Bug #7573]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1959,7 +1959,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) rb_raise(rb_eNameError, "wrong constant name %s", path); } - if (p[0] == ':' && p[1] == ':') { + if (p + 2 < pend && p[0] == ':' && p[1] == ':') { mod = rb_cObject; p += 2; pbeg = p; @@ -1981,8 +1981,8 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) else { part = rb_str_subseq(name, pbeg-path, p-pbeg); } - if (p[0] == ':') { - if (p[1] != ':') { + if (p < pend && p[0] == ':') { + if (p + 2 >= pend || p[1] != ':') { rb_raise(rb_eNameError, "wrong constant name %s", path); } p += 2; |