mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Need more precise constant name check.
This change was inspired by [ruby-bugs#7573]
This commit is contained in:
+8
-1
@@ -1981,7 +1981,14 @@ mrb_mod_const_get(mrb_state *mrb, mrb_value mod)
|
||||
end = (end == -1) ? len : end;
|
||||
id = mrb_intern(mrb, ptr+off, end-off);
|
||||
mod = mrb_const_get_sym(mrb, mod, id);
|
||||
off = (end == len) ? end : end+2;
|
||||
if (end == len)
|
||||
off = end;
|
||||
else {
|
||||
off = end + 2;
|
||||
if (off == len) { /* trailing "::" */
|
||||
mrb_name_error(mrb, id, "wrong constant name '%S'", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mod;
|
||||
|
||||
Reference in New Issue
Block a user