summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/kpsewhich.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index a0faf354f8d..989071edbd8 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-13 Karl Berry <karl@tug.org>
+
+ * kpsewhich.c (subdir_match): protect again loc going infinitely
+ negative. Found by dak, 8 Jan 2008 14:51:08.
+
2008-01-05 Karl Berry <karl@tug.org>
* texmf.in (progname, engine): distinguish the unset values.
diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c
index 2ef873c3e6a..98f5c51b002 100644
--- a/Build/source/texk/kpathsea/kpsewhich.c
+++ b/Build/source/texk/kpathsea/kpsewhich.c
@@ -1,7 +1,7 @@
/* kpsewhich -- standalone path lookup and variable expansion for Kpathsea.
Ideas from Thomas Esser, Pierre MacKay, and many others.
- Copyright (C) 1995-2007 Karl Berry & Olaf Weber.
+ Copyright (C) 1995-2008 Karl Berry & Olaf Weber.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -188,7 +188,7 @@ subdir_match P2C(str_list_type, subdirs, string *, matches)
string s = xstrdup (matches[m]);
for (loc = strlen (s); loc > 0 && !IS_DIR_SEP (s[loc-1]); loc--)
;
- while (IS_DIR_SEP (s[loc-1])) {
+ while (loc > 0 && IS_DIR_SEP (s[loc-1])) {
loc--;
}
s[loc] = 0; /* wipe out basename */