mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
a7ebfe4b71
commit
29b5de1de2
1 changed files with 1 additions and 1 deletions
2
dir.c
2
dir.c
|
@ -1200,7 +1200,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
|
||||||
while (p < e && *p) {
|
while (p < e && *p) {
|
||||||
tmp = GLOB_ALLOC(struct glob_pattern);
|
tmp = GLOB_ALLOC(struct glob_pattern);
|
||||||
if (!tmp) goto error;
|
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) */
|
/* fold continuous RECURSIVEs (needed in glob_helper) */
|
||||||
do { p += 3; while (*p == '/') p++; } while (p[0] == '*' && p[1] == '*' && p[2] == '/');
|
do { p += 3; while (*p == '/') p++; } while (p[0] == '*' && p[1] == '*' && p[2] == '/');
|
||||||
tmp->type = RECURSIVE;
|
tmp->type = RECURSIVE;
|
||||||
|
|
Loading…
Reference in a new issue