From 57611240a972932ef26a13c6998a7fa90fd33371 Mon Sep 17 00:00:00 2001 From: dearblue Date: Thu, 24 Sep 2020 22:25:26 +0900 Subject: Prohibit string changes by "s"/"z" specifier of `mrb_get_args()` - The `s` specifier is a string pointer obtained without performing `mrb_str_modify()`, so it cannot be changed. - The `z` specifier cannot be changed because it is a string pointer obtained by `RSTRING_CSTR()` which returns `const char *`. --- mrbgems/mruby-eval/src/eval.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mrbgems/mruby-eval/src/eval.c') diff --git a/mrbgems/mruby-eval/src/eval.c b/mrbgems/mruby-eval/src/eval.c index eaf07cabe..af6837b81 100644 --- a/mrbgems/mruby-eval/src/eval.c +++ b/mrbgems/mruby-eval/src/eval.c @@ -12,7 +12,7 @@ mrb_value mrb_obj_instance_eval(mrb_state *mrb, mrb_value self); void mrb_codedump_all(mrb_state*, struct RProc*); static struct RProc* -create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding, const char *file, mrb_int line) +create_proc_from_string(mrb_state *mrb, const char *s, mrb_int len, mrb_value binding, const char *file, mrb_int line) { mrbc_context *cxt; struct mrb_parser_state *p; @@ -131,10 +131,10 @@ exec_irep(mrb_state *mrb, mrb_value self, struct RProc *proc) static mrb_value f_eval(mrb_state *mrb, mrb_value self) { - char *s; + const char *s; mrb_int len; mrb_value binding = mrb_nil_value(); - char *file = NULL; + const char *file = NULL; mrb_int line = 1; struct RProc *proc; @@ -154,9 +154,9 @@ f_instance_eval(mrb_state *mrb, mrb_value self) mrb_get_args(mrb, "*!&", &argv, &argc, &b); if (mrb_nil_p(b)) { - char *s; + const char *s; mrb_int len; - char *file = NULL; + const char *file = NULL; mrb_int line = 1; mrb_value cv; struct RProc *proc; -- cgit v1.2.3