texlive[45684] Build/source/texk/kpathsea: checks for empty program

commits+karl at tug.org commits+karl at tug.org
Fri Nov 3 23:50:58 CET 2017


Revision: 45684
          http://tug.org/svn/texlive?view=revision&revision=45684
Author:   karl
Date:     2017-11-03 23:50:57 +0100 (Fri, 03 Nov 2017)
Log Message:
-----------
checks for empty program name, empty default strings

Modified Paths:
--------------
    trunk/Build/source/texk/kpathsea/ChangeLog
    trunk/Build/source/texk/kpathsea/cnf.c
    trunk/Build/source/texk/kpathsea/default.h
    trunk/Build/source/texk/kpathsea/hash.c
    trunk/Build/source/texk/kpathsea/kdefault.c

Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog	2017-11-03 21:38:44 UTC (rev 45683)
+++ trunk/Build/source/texk/kpathsea/ChangeLog	2017-11-03 22:50:57 UTC (rev 45684)
@@ -1,3 +1,15 @@
+2017-11-03  Karl Berry  <karl at freefriends.org>
+
+	* 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  <karl at freefriends.org>
 
 	* several files: missed copyright 2017 updates.

Modified: trunk/Build/source/texk/kpathsea/cnf.c
===================================================================
--- trunk/Build/source/texk/kpathsea/cnf.c	2017-11-03 21:38:44 UTC (rev 45683)
+++ trunk/Build/source/texk/kpathsea/cnf.c	2017-11-03 22:50:57 UTC (rev 45684)
@@ -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 @@
     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

Modified: trunk/Build/source/texk/kpathsea/default.h
===================================================================
--- trunk/Build/source/texk/kpathsea/default.h	2017-11-03 21:38:44 UTC (rev 45683)
+++ trunk/Build/source/texk/kpathsea/default.h	2017-11-03 22:50:57 UTC (rev 45684)
@@ -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,

Modified: trunk/Build/source/texk/kpathsea/hash.c
===================================================================
--- trunk/Build/source/texk/kpathsea/hash.c	2017-11-03 21:38:44 UTC (rev 45683)
+++ trunk/Build/source/texk/kpathsea/hash.c	2017-11-03 22:50:57 UTC (rev 45684)
@@ -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 @@
   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)
 {

Modified: trunk/Build/source/texk/kpathsea/kdefault.c
===================================================================
--- trunk/Build/source/texk/kpathsea/kdefault.c	2017-11-03 21:38:44 UTC (rev 45683)
+++ trunk/Build/source/texk/kpathsea/kdefault.c	2017-11-03 22:50:57 UTC (rev 45684)
@@ -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 @@
 {
   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 :?  */



More information about the tex-live-commits mailing list