summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 293386349e..a71f5825fd 100644
--- a/dir.c
+++ b/dir.c
@@ -343,7 +343,10 @@ static VALUE dir_close(VALUE);
/* can contain null bytes as separators */ \
(!RB_TYPE_P(str, T_STRING) ? \
FilePathValue(str) : \
- (safe) ? (rb_check_safe_obj(str), (str)) : (str))
+ (check_safe_glob(str, safe), \
+ check_glob_encoding(str), (str)))
+#define check_safe_glob(str, safe) ((safe) ? rb_check_safe_obj(str) : (void)0)
+#define check_glob_encoding(str) rb_enc_check((str), rb_enc_from_encoding(rb_usascii_encoding()))
static VALUE
dir_s_alloc(VALUE klass)