summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-12-04 19:03:48 +0000
committerKarl Berry <karl@freefriends.org>2009-12-04 19:03:48 +0000
commit356ac6d75d6b87afe160237c38d0d3d7cba15c34 (patch)
tree4bd9f3b8b1a8b3f839249a1bc175aae8d3b6b405
parent96a97518eb514799c5613b37c1fe9da018aab47b (diff)
consider ..foobar not_ok
git-svn-id: svn://tug.org/texlive/trunk@16295 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/tex-file.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 9adefcb0f3d..5eab68872f3 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-04 Karl Berry <karl@tug.org>
+
+ * tex-file.c (kpathsea_name_ok): not_ok if /..foobar.
+ Report/patches from Alexander and Akira.
+
2009-12-03 Karl Berry <karl@tug.org>
* absolute.c, * absolute.h, * cnf.c, * db.c, * dir.c, * elt-dirs.c,
diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c
index e65ef95d282..27c2c27146a 100644
--- a/Build/source/texk/kpathsea/tex-file.c
+++ b/Build/source/texk/kpathsea/tex-file.c
@@ -1131,16 +1131,19 @@ kpathsea_name_ok (kpathsea kpse, const_string fname, const_string check_var,
etc. But allow .tex (for base LaTeX). */
const_string q;
const_string qq = fname;
- while ((q = strchr (qq, '.'))) {
- if ((q == fname || IS_DIR_SEP (*(q - 1)))
- && !IS_DIR_SEP (*(q + 1))
- && *(q + 1) != '.'
- && !STREQ (q, ".tex")) {
+ while ((q = strchr (qq, '.'))) { /* at each dot */
+ if ((q == fname || IS_DIR_SEP (*(q - 1))) /* start or / precedes dot? */
+ && !IS_DIR_SEP (*(q + 1)) /* ok if /./ */
+ && *(q + 1) != '.' /* ok (for now) if /.. */
+ && !STREQ (q, ".tex")) { /* specially allow .tex */
goto not_ok;
}
qq = q + 1;
- if (*(qq) == '.')
+ if (*(qq) == '.') { /* further checks if .. */
qq++;
+ if (!IS_DIR_SEP (*qq)) /* ../ ok, all else bad */
+ goto not_ok;
+ }
}
}
#else