summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/tex-file.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-11-18 13:55:45 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-11-18 13:55:45 +0000
commited75b1a94192c021262e040b590c75d624269162 (patch)
treefbbc8f2eb505360379f01306f2770e861e474ebf /Build/source/texk/kpathsea/tex-file.c
parentd6b68e58217ed2971ab581a9c0e4db84b70d0fd6 (diff)
texk/kpathsea: Disallow writing file in dotted directories
texk/dvisvgm: minor cleanup git-svn-id: svn://tug.org/texlive/trunk@16064 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/tex-file.c')
-rw-r--r--Build/source/texk/kpathsea/tex-file.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c
index 30d7d0fca26..dcd64219c76 100644
--- a/Build/source/texk/kpathsea/tex-file.c
+++ b/Build/source/texk/kpathsea/tex-file.c
@@ -1116,11 +1116,19 @@ kpathsea_name_ok (kpathsea kpse, const_string fname, const_string check_var,
#if defined (unix) && !defined (MSDOS)
{
- const_string base = xbasename (fname);
- /* Disallow .rhosts, .login, etc. Allow .tex (for LaTeX). */
- if (base[0] == 0 ||
- (base[0] == '.' && !IS_DIR_SEP(base[1]) && !STREQ (base, ".tex")))
- goto not_ok;
+ /* Disallow .rhosts, .login, .ssh/, etc. Allow .tex (for LaTeX). */
+ string q, qq = fname;
+ while ((q = strchr (qq, '.'))) {
+ if ((q == fname || IS_DIR_SEP (*(q - 1))) &&
+ !IS_DIR_SEP (*(q + 1)) &&
+ *(q + 1) != '.' &&
+ !STREQ (q, ".tex")) {
+ goto not_ok;
+ }
+ qq = q + 1;
+ if (*(qq) == '.')
+ qq++;
+ }
}
#else
/* Other OSs don't have special names? */