From 62087581f05ba06054be6b589fd81da692d5e16a Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 23 Oct 2020 22:18:37 +0000 Subject: More than one directory separators in filename+2 should not exist in \\?\ form of absolute path (w32 only). git-svn-id: svn://tug.org/texlive/trunk@56741 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 5 +++++ Build/source/texk/kpathsea/knj.c | 26 ++++++++++++++++++++++++++ Build/source/texk/kpathsea/readable.c | 13 +++++++++++++ 3 files changed, 44 insertions(+) (limited to 'Build/source/texk/kpathsea') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index e6e3b70c4d1..a4d3b1b64ea 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,8 @@ +2020-10-24 Akira Kakuto + + * readable.c, knj.c: More than one directory separators in + filename+2 should not exist in \\?\ form of absolute path. + 2020-08-26 Karl Berry * texmf.cnf (save_size): double to 200,000. Needed with diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c index 9440438b0f5..0498319c606 100644 --- a/Build/source/texk/kpathsea/knj.c +++ b/Build/source/texk/kpathsea/knj.c @@ -127,12 +127,25 @@ kpathsea_fsyscp_xfopen (kpathsea kpse, const char *filename, const char *mode) Windows, if it really exists and input name is given in full-absolute path in a command line. /./ , /../, \.\, \..\ should be excluded. (2020/06/06) + More than one directory separators should be excluded. (2020/10/24) */ fnn = xmalloc(len + 10); p = strstr(filename, ".\\"); if (!p) { p = strstr(filename, "./"); } + if (!p && len > 2) { + p = strstr(filename + 2, "//"); + } + if (!p && len > 2) { + p = strstr(filename + 2, "\\\\"); + } + if (!p && len > 2) { + p = strstr(filename + 2, "\\/"); + } + if (!p && len > 2) { + p = strstr(filename + 2, "/\\"); + } if (!p && len > 2 && ((filename[0] == '/' && filename[1] == '/') || (filename[0] == '\\' && filename[1] == '\\' && filename[2] != '?'))) { @@ -192,12 +205,25 @@ kpathsea_fsyscp_fopen (kpathsea kpse, const char *filename, const char *mode) Windows, if it really exists and input name is given in full-absolute path in a command line. /./ , /../, \.\, \..\ should be excluded. (2020/06/06) + More than one directory separators should be excluded. (2020/10/24) */ fnn = xmalloc(len + 10); p = strstr(filename, ".\\"); if (!p) { p = strstr(filename, "./"); } + if (!p && len > 2) { + p = strstr(filename + 2, "//"); + } + if (!p && len > 2) { + p = strstr(filename + 2, "\\\\"); + } + if (!p && len > 2) { + p = strstr(filename + 2, "\\/"); + } + if (!p && len > 2) { + p = strstr(filename + 2, "/\\"); + } if (!p && len > 2 && ((filename[0] == '/' && filename[1] == '/') || (filename[0] == '\\' && filename[1] == '\\' && filename[2] != '?'))) { diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c index dc83f36bd28..182a5e69a16 100644 --- a/Build/source/texk/kpathsea/readable.c +++ b/Build/source/texk/kpathsea/readable.c @@ -51,11 +51,24 @@ READABLE(kpathsea kpse, const_string fn, unsigned int st) Windows, if it really exists and input name is given in full-absolute path in a command line. /../, /./, \..\, \.\ should be excluded (2020/06/06) + More than one directory separators should be excluded. (2020/10/24) */ p = strstr(fn, ".\\"); if (!p) { p = strstr(fn, "./"); } + if (!p && len > 2) { + p = strstr(fn + 2, "//"); + } + if (!p && len > 2) { + p = strstr(fn + 2, "\\\\"); + } + if (!p && len > 2) { + p = strstr(fn + 2, "\\/"); + } + if (!p && len > 2) { + p = strstr(fn + 2, "/\\"); + } if (!p && len > 2 && ((fn[0] == '/' && fn[1] == '/') || (fn[0] == '\\' && fn[1] == '\\' && fn[2] != '?'))) { fn += 2; -- cgit v1.2.3