summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-25 09:32:47 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-25 09:32:47 +0000
commita0b3e032020b77898cbc4be04559456a3cb6f10b (patch)
tree870ee7c127a2673b036e84cc42ef4a760ec80f0b /dir.c
parent7b5a42f0fa54dbb0d381ffbe3b8de6601577c518 (diff)
* dir.c (bracket): fix copy-paste error. When the first and last
characters of fnmatch range have different length, fnmatch may have wrongly matched a path that does not really match. Coverity Scan found this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 29047dc528..9eccadbcf5 100644
--- a/dir.c
+++ b/dir.c
@@ -178,7 +178,7 @@ bracket(
p = t2 + (r2 = rb_enc_mbclen(t2, pend, enc));
if (ok) continue;
if ((r <= (send-s) && memcmp(t1, s, r) == 0) ||
- (r2 <= (send-s) && memcmp(t2, s, r) == 0)) {
+ (r2 <= (send-s) && memcmp(t2, s, r2) == 0)) {
ok = 1;
continue;
}