summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 10:26:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 10:26:40 +0000
commitaf1ca4cb132dba91dd88471170d3106d304f0e24 (patch)
tree822c0c91a493e05f4071fe2b620abfe73319580c /object.c
parent6a35c26b2dfbd2a516e450e916eb8d13c3ff5ddf (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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/object.c b/object.c
index 13765bc621..b385135019 100644
--- a/object.c
+++ b/object.c
@@ -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;