[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1814-g1159afb
[email protected] (Julian Smith) Tue, 5 Nov 2019 16:01:10 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 1159afbcad927e1a32008b0ab87e257fc21da8e2 (commit)
from 67b4efc310af7bf9d30f84a70c6b9858ab138e3d (commit)
----------------------------------------------------------------------
commit 1159afbcad927e1a32008b0ab87e257fc21da8e2
Author: Julian Smith <[email protected]>
Date: Tue Nov 5 15:02:23 2019 +0000
Ensure strncpy() terminates when called from pjl_parsed_filename_to_string().
Passing strlen()+1 to strncpy() ensures that it will terminate the
string. Possibly not required here because the code always terminates the
string, but this might fix coverity issue 102147.
diff --git a/pcl/pl/pjparse.c b/pcl/pl/pjparse.c
index c0fd4e7..72c1be7 100644
--- a/pcl/pl/pjparse.c
+++ b/pcl/pl/pjparse.c
@@ -550,12 +550,13 @@ pjl_parsed_filename_to_string(char *fnamep, const char *pathname)
return; /* bad input pjl file */
if (pathname[1] == '0' && pathname[2] == ':') {
- /* copy pjl_volume string in */
- strncpy(fnamep, PJL_VOLUME_0, strlen(PJL_VOLUME_0));
+ /* copy pjl_volume string in. use strlen+1 to ensure that strncpy()
+ appends '\0', to keep coverity quiet. */
+ strncpy(fnamep, PJL_VOLUME_0, strlen(PJL_VOLUME_0)+1);
fnamep += strlen(PJL_VOLUME_0);
} else if (pathname[1] == '1' && pathname[2] == ':') {
/* copy pjl_volume string in */
- strncpy(fnamep, PJL_VOLUME_1, strlen(PJL_VOLUME_1));
+ strncpy(fnamep, PJL_VOLUME_1, strlen(PJL_VOLUME_1)+1);
fnamep += strlen(PJL_VOLUME_1);
} else
return; /* bad input pjl file */
Summary of changes:
pcl/pl/pjparse.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)