1
0
Fork 0
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:
nobu 2014-05-16 08:22:41 +00:00
parent a7ebfe4b71
commit 29b5de1de2

2
dir.c
View file

@ -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;