From d280e23580526277e20890e40d6551dd390851f4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 3 Nov 2017 22:50:57 +0000 Subject: checks for empty program name, empty default strings git-svn-id: svn://tug.org/texlive/trunk@45684 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 12 ++++++++++++ Build/source/texk/kpathsea/cnf.c | 5 +++-- Build/source/texk/kpathsea/default.h | 3 ++- Build/source/texk/kpathsea/hash.c | 4 ++-- Build/source/texk/kpathsea/kdefault.c | 7 ++++--- 5 files changed, 23 insertions(+), 8 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 4d97a049d67..0bf640eb329 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,15 @@ +2017-11-03 Karl Berry + + * default.h: document that NULL or empty input path returns the + default string. + * kdefault.c (kpathsea_expand_default): check for empty input path. + From Doug McKenna, personal mail, 2nov17. + + * cnf.c (do_line): do not move past a nul byte on erroneous input + (with a . but no program name). + * hash.c: doc fix. + From Doug McKenna, personal mail, 31oct17. + 2017-10-29 Karl Berry * several files: missed copyright 2017 updates. diff --git a/Build/source/texk/kpathsea/cnf.c b/Build/source/texk/kpathsea/cnf.c index e216a18d172..b8d4a9c69ac 100644 --- a/Build/source/texk/kpathsea/cnf.c +++ b/Build/source/texk/kpathsea/cnf.c @@ -1,6 +1,7 @@ /* cnf.c: read config files. - Copyright 1994, 1995, 1996, 1997, 2008, 2009, 2011, 2012, 2016 Karl Berry. + Copyright 1994, 1995, 1996, 1997, 2008, 2009, 2011, 2012, 2016, + 2017 Karl Berry. Copyright 1997-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -105,7 +106,7 @@ do_line (kpathsea kpse, string line) while (ISSPACE (*line)) line++; start = line; - while (!ISSPACE (*line) && *line != '=') + while (*line && !ISSPACE (*line) && *line != '=') line++; /* It's annoying to repeat all this, but making a tokenizing diff --git a/Build/source/texk/kpathsea/default.h b/Build/source/texk/kpathsea/default.h index a84d874d076..50fc1fc7c45 100644 --- a/Build/source/texk/kpathsea/default.h +++ b/Build/source/texk/kpathsea/default.h @@ -1,6 +1,6 @@ /* default.h: declare default path expander. - Copyright 1993, 1994, 2008, 2011 Karl Berry. + Copyright 1993, 1994, 2008, 2011, 2017 Karl Berry. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,6 +26,7 @@ /* Replace a leading or trailing or doubled : in PATH with DFLT. If no extra colons, return PATH. Only one extra colon is replaced. + If PATH is NULL or the empty string, DFLT is returned. DFLT may not be NULL. The result is always in new memory. */ extern string kpathsea_expand_default (kpathsea kpse, const_string path, diff --git a/Build/source/texk/kpathsea/hash.c b/Build/source/texk/kpathsea/hash.c index 0b126ce8369..7fe12b7b403 100644 --- a/Build/source/texk/kpathsea/hash.c +++ b/Build/source/texk/kpathsea/hash.c @@ -1,6 +1,6 @@ /* hash.c: hash table operations. - Copyright 1994-2000, 2002, 2005, 2008, 2012, 2016 + Copyright 1994-2000, 2002, 2005, 2008, 2012, 2016, 2017 Karl Berry & Olaf Weber. This library is free software; you can redistribute it and/or @@ -46,7 +46,7 @@ hash (hash_table_type table, const_string key) return n; } -/* Identical has function as above, but does not normalize keys. */ +/* Identical hash function as above, but does not normalize keys. */ static unsigned hash_normalized (hash_table_type table, const_string key) { diff --git a/Build/source/texk/kpathsea/kdefault.c b/Build/source/texk/kpathsea/kdefault.c index bc25a5c2023..a0fc268eec3 100644 --- a/Build/source/texk/kpathsea/kdefault.c +++ b/Build/source/texk/kpathsea/kdefault.c @@ -3,7 +3,7 @@ make a program `default' from it, since we have a target `default'; and OSF/1 make doesn't understand .PHONY.) - Copyright 1993, 1994, 1996, 2008, 2009, 2011 Karl Berry. + Copyright 1993, 1994, 1996, 2008, 2009, 2011, 2017 Karl Berry. Copyright 2002, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -34,12 +34,13 @@ kpathsea_expand_default (kpathsea kpse, const_string path, { unsigned path_length; string expansion; - (void)kpse; /* currenty not used */ + + (void) kpse; /* unused */ /* The default path better not be null. */ assert (fallback); - if (path == NULL) + if (path == NULL || *path == 0) expansion = xstrdup (fallback); /* Solitary or leading :? */ -- cgit v1.2.3