From 29b5de1de275fcef88dd3a04ec822eabed91cf80 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 16 May 2014 08:22:41 +0000 Subject: 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 --- dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index 777fa55b63..35e9aa71d2 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; -- cgit v1.2.3