summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-20 14:23:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-20 14:23:16 +0000
commit89130aa8e17642a8b60c02030610e12124f25721 (patch)
treeda73a9f62c0a7b45c8bc80aa474639368cab2c7b /dir.c
parentc7caeda5ed20938974ccb7dd6bfddad1e65cb18e (diff)
* dir.c (bracket): get rid of scanning at the end of the pattern
string, not to raise an exception while globbing command line. [ruby-core:32478] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index f9867e44d7..a5c6acd827 100644
--- a/dir.c
+++ b/dir.c
@@ -108,6 +108,7 @@ bracket(
int r;
int ok = 0, not = 0;
+ if (p >= pend) return NULL;
if (*p == '!' || *p == '^') {
not = 1;
p++;
@@ -120,6 +121,7 @@ bracket(
if (!*t1)
return NULL;
p = t1 + (r = rb_enc_mbclen(t1, pend, enc));
+ if (p >= pend) return NULL;
if (p[0] == '-' && p[1] != ']') {
const char *t2 = p + 1;
int r2;