mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-io (mrb_file_s_chmod): check string type before casting
This commit is contained in:
@@ -738,6 +738,7 @@ mrb_file_s_chmod(mrb_state *mrb, mrb_value klass)
|
||||
|
||||
mrb_get_args(mrb, "i*", &mode, &filenames, &argc);
|
||||
for (int i = 0; i < argc; i++) {
|
||||
mrb_ensure_string_type(mrb, filenames[i]);
|
||||
const char *utf8_path = RSTRING_CSTR(mrb, filenames[i]);
|
||||
char *path = mrb_locale_from_utf8(utf8_path, -1);
|
||||
if (CHMOD(path, mode) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user