summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-16 08:22:41 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-16 08:22:41 (GMT)
commit29b5de1de275fcef88dd3a04ec822eabed91cf80 (patch)
tree8ed11bd830cbeabddf6b9a1e1ebea830735e46a4 /dir.c
parenta7ebfe4b7182a42ac8312bd00027fe5ed77ce989 (diff)
dir.c: check boundary
* dir.c (glob_make_pattern): check boundary before accessing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45957 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 777fa55..35e9aa7 100644
--- a/dir.c
+++ b/dir.c
@@ -1200,7 +1200,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
while (p < e && *p) {
tmp = GLOB_ALLOC(struct glob_pattern);
if (!tmp) goto error;
- if (p[0] == '*' && p[1] == '*' && p[2] == '/') {
+ if (p + 2 < e && p[0] == '*' && p[1] == '*' && p[2] == '/') {
/* fold continuous RECURSIVEs (needed in glob_helper) */
do { p += 3; while (*p == '/') p++; } while (p[0] == '*' && p[1] == '*' && p[2] == '/');
tmp->type = RECURSIVE;