Merge pull request #5754 from artichoke/lopopolo/class-name-use-after-free

Fix possible use after free in `mrb_class_find_path`
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-07-25 15:41:07 +09:00
committed by GitHub
+1 -1
View File
@@ -1108,8 +1108,8 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c)
if (outer == NULL) return mrb_nil_value();
name = find_class_sym(mrb, outer, c);
if (name == 0) return mrb_nil_value();
str = mrb_class_name(mrb, outer);
path = mrb_str_new_capa(mrb, 40);
str = mrb_class_name(mrb, outer);
mrb_str_cat_cstr(mrb, path, str);
mrb_str_cat_cstr(mrb, path, "::");