[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-2012-gfbd7765

[email protected] (Chris Liddell) Fri, 6 Dec 2019 12:43:40 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  fbd776580b26bdf27bcf5778dea94b446c786f67 (commit)
      from  53ab3ecee8a60d412c2bf1406340bf9cb228e106 (commit)

----------------------------------------------------------------------
commit fbd776580b26bdf27bcf5778dea94b446c786f67
Author: Chris Liddell <[email protected]>
Date:   Thu Dec 5 12:50:26 2019 +0000

    Coverity ID 351435: reduce buffer size passed to strncat()
    
    Fixes an (unlikely) potential buffer overflow

diff --git a/base/gp_unix.c b/base/gp_unix.c
index ecf0e8a..bd2745f 100644
--- a/base/gp_unix.c
+++ b/base/gp_unix.c
@@ -358,8 +358,8 @@ void *gp_enumerate_fonts_init(gs_memory_t *mem)
     while ((dirstr = FcStrListNext(fdirlist)) != NULL && code >= 0) {
         char dirstr2[gp_file_name_sizeof];
         dirstr2[0] = '\0';
-        strncat(dirstr2, (char *)dirstr, gp_file_name_sizeof - 1);
-        strncat(dirstr2, "/", gp_file_name_sizeof);
+        strncat(dirstr2, (char *)dirstr, gp_file_name_sizeof - 2);
+        strncat(dirstr2, "/", gp_file_name_sizeof - 1);
         code = gs_add_control_path(mem, gs_permit_file_reading, (char *)dirstr2);
     }
     FcStrListDone(fdirlist);


Summary of changes:
 base/gp_unix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)