diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/knj.c | 18 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/readable.c | 9 |
3 files changed, 26 insertions, 6 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 933079c1680..439f26a6032 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,8 @@ +2020-06-06 Akira Kakuto <kakuto@w32tex.org> + + * readable.c, knj.c: /../, /./, \..\, \.\ should not exist + in \\?\ form of absolute path. + 2020-04-28 Akira Kakuto <kakuto@w32tex.org> * readable.c, knj.c: Support very long input path name, diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c index 147f7e084c7..9440438b0f5 100644 --- a/Build/source/texk/kpathsea/knj.c +++ b/Build/source/texk/kpathsea/knj.c @@ -126,15 +126,20 @@ kpathsea_fsyscp_xfopen (kpathsea kpse, const char *filename, const char *mode) Support very long input path name, longer than _MAX_PATH for Windows, if it really exists and input name is given in full-absolute path in a command line. + /./ , /../, \.\, \..\ should be excluded. (2020/06/06) */ fnn = xmalloc(len + 10); - if (len > 2 && ((filename[0] == '/' && filename[1] == '/') || + p = strstr(filename, ".\\"); + if (!p) { + p = strstr(filename, "./"); + } + if (!p && len > 2 && ((filename[0] == '/' && filename[1] == '/') || (filename[0] == '\\' && filename[1] == '\\' && filename[2] != '?'))) { filename += 2; strcpy (fnn, "\\\\?\\UNC\\"); strcat (fnn, filename); - } else if (len > 2 && filename[1] == ':') { + } else if (!p && len > 2 && filename[1] == ':') { strcpy (fnn, "\\\\?\\"); strcat (fnn, filename); } else { @@ -186,15 +191,20 @@ kpathsea_fsyscp_fopen (kpathsea kpse, const char *filename, const char *mode) Support very long input path name, longer than _MAX_PATH for Windows, if it really exists and input name is given in full-absolute path in a command line. + /./ , /../, \.\, \..\ should be excluded. (2020/06/06) */ fnn = xmalloc(len + 10); - if (len > 2 && ((filename[0] == '/' && filename[1] == '/') || + p = strstr(filename, ".\\"); + if (!p) { + p = strstr(filename, "./"); + } + if (!p && len > 2 && ((filename[0] == '/' && filename[1] == '/') || (filename[0] == '\\' && filename[1] == '\\' && filename[2] != '?'))) { filename += 2; strcpy (fnn, "\\\\?\\UNC\\"); strcat (fnn, filename); - } else if (len > 2 && filename[1] == ':') { + } else if (!p && len > 2 && filename[1] == ':') { strcpy (fnn, "\\\\?\\"); strcat (fnn, filename); } else { diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c index 8f4f94fa8c7..dc83f36bd28 100644 --- a/Build/source/texk/kpathsea/readable.c +++ b/Build/source/texk/kpathsea/readable.c @@ -50,13 +50,18 @@ READABLE(kpathsea kpse, const_string fn, unsigned int st) Support very long input path name, longer than _MAX_PATH for Windows, if it really exists and input name is given in full-absolute path in a command line. + /../, /./, \..\, \.\ should be excluded (2020/06/06) */ - if (len > 2 && ((fn[0] == '/' && fn[1] == '/') || + p = strstr(fn, ".\\"); + if (!p) { + p = strstr(fn, "./"); + } + if (!p && len > 2 && ((fn[0] == '/' && fn[1] == '/') || (fn[0] == '\\' && fn[1] == '\\' && fn[2] != '?'))) { fn += 2; strcpy (fnn, "\\\\?\\UNC\\"); strcat (fnn, fn); - } else if (len > 2 && fn[1] == ':') { + } else if (!p && len > 2 && fn[1] == ':') { strcpy (fnn, "\\\\?\\"); strcat (fnn, fn); } else { |