ruby-changes:33876
From: nobu <ko1@a...>
Date: Fri, 16 May 2014 17:22:59 +0900 (JST)
Subject: [ruby-changes:33876] nobu:r45957 (trunk): dir.c: check boundary
nobu 2014-05-16 17:22:41 +0900 (Fri, 16 May 2014) New Revision: 45957 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45957 Log: dir.c: check boundary * dir.c (glob_make_pattern): check boundary before accessing. Modified files: trunk/dir.c Index: dir.c =================================================================== --- dir.c (revision 45956) +++ dir.c (revision 45957) @@ -1200,7 +1200,7 @@ glob_make_pattern(const char *p, const c https://github.com/ruby/ruby/blob/trunk/dir.c#L1200 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/