summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-15 03:00:31 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-15 03:00:31 +0000
commit31c1883a54335d4ecad81919d8f9cb7a0fc4ffce (patch)
tree7c29b8c910bf8d7a01dd2fef6b6ae2e8c0886201 /dir.c
parent205c4b490cf4d66484f7357646cbf8748e427c5b (diff)
* dir.c (fnmatch_helper): use rb_enc_precise_mbclen and
fail if bytes are invalid. [ruby-dev:38307] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 522818b663..be642d38eb 100644
--- a/dir.c
+++ b/dir.c
@@ -224,7 +224,9 @@ fnmatch_helper(
RETURN(ISEND(p) ? 0 : FNM_NOMATCH);
if (ISEND(p))
goto failed;
- r = rb_enc_mbclen(p, pend, enc);
+ r = rb_enc_precise_mbclen(p, pend, enc);
+ if (!MBCLEN_CHARFOUND_P(r))
+ goto failed;
if (r <= (send-s) && memcmp(p, s, r) == 0) {
p += r;
s += r;