aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0068-fix-glob-descent-into-.-and-.-with-GLOB_PERIOD.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/musl/0068-fix-glob-descent-into-.-and-.-with-GLOB_PERIOD.patch')
-rw-r--r--main/musl/0068-fix-glob-descent-into-.-and-.-with-GLOB_PERIOD.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/musl/0068-fix-glob-descent-into-.-and-.-with-GLOB_PERIOD.patch b/main/musl/0068-fix-glob-descent-into-.-and-.-with-GLOB_PERIOD.patch
new file mode 100644
index 0000000000..99f3547ed1
--- /dev/null
+++ b/main/musl/0068-fix-glob-descent-into-.-and-.-with-GLOB_PERIOD.patch
@@ -0,0 +1,33 @@
+From 8c4be3e2209d2a1d3874b8bc2b474668fcbbbac6 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 6 Sep 2017 21:59:22 -0400
+Subject: [PATCH 26/30] fix glob descent into . and .. with GLOB_PERIOD
+
+GLOB_PERIOD is a gnu extension, and GNU glob does not seem to honor it
+except in the last path component. it's not clear whether this a bug
+or intentional, but it seems reasonable that it should exclude the
+special entries . and .. when walking.
+
+changes based on report and analysis by Julien Ramseier.
+---
+ src/regex/glob.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/regex/glob.c b/src/regex/glob.c
+index 2d4d562e..6f8425ca 100644
+--- a/src/regex/glob.c
++++ b/src/regex/glob.c
+@@ -100,6 +100,10 @@ static int match_in_dir(const char *d, const char *p, int flags, int (*errfunc)(
+ continue;
+ if (p2 && de->d_type && !S_ISDIR(de->d_type<<12) && !S_ISLNK(de->d_type<<12))
+ continue;
++ if (p2 && de->d_name[0]=='.' && !de->d_name[1])
++ continue;
++ if (p2 && de->d_name[0]=='.' && de->d_name[1]=='.' && !de->d_name[2])
++ continue;
+ if (*d) {
+ memcpy(name, d, l);
+ name[l] = '/';
+--
+2.13.3
+