diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-16 08:22:41 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-16 08:22:41 +0000 |
commit | 29b5de1de275fcef88dd3a04ec822eabed91cf80 (patch) | |
tree | 8ed11bd830cbeabddf6b9a1e1ebea830735e46a4 /dir.c | |
parent | a7ebfe4b7182a42ac8312bd00027fe5ed77ce989 (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |