[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1719-g797ddfc

[email protected] (Chris Liddell) Thu, 10 Oct 2019 10:20:15 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  797ddfc6ef5f0cdfba664f550fe57acc43f309bb (commit)
      from  d45d594ea5660976a21106ea864eb879801827b1 (commit)

----------------------------------------------------------------------
commit 797ddfc6ef5f0cdfba664f550fe57acc43f309bb
Author: Chris Liddell <[email protected]>
Date:   Thu Oct 10 10:15:49 2019 +0100

    Fix the logic for permitted directories
    
    The logic to match a permitted path ending in a directory separator with any
    file in that directory (but only that directory) was wrong, causing us to
    reject such cases.

diff --git a/base/gpmisc.c b/base/gpmisc.c
index 9cca5d5..96052fc 100644
--- a/base/gpmisc.c
+++ b/base/gpmisc.c
@@ -969,7 +969,11 @@ validate(const gs_memory_t *mem,
                     const char *aend = path + strlen(path);
                     while (aend != a2 && !gs_file_name_check_separator(a2, 1, a2))
                       a2++;
-                    if (aend != a2)
+                    /* If the control path ends in a directory separator and we've scanned
+                       to the end of the candidate path with no further directory separators
+                       found, we have a match
+                     */
+                    if (aend == a2)
                       /* PATH=abc/? pattern=abc/ */
                       goto found; /* Bingo! */
                  }


Summary of changes:
 base/gpmisc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)