diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2023-03-09 20:01:45 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2023-03-09 20:01:45 +0000 |
commit | 0996eae84c9c823c8b2346e14203f31099cdbbbe (patch) | |
tree | 0e9e619c17f7d62e8b551eecd5cd5e848936443a /psi | |
parent | 7456fbd3b0581c278279b5f138adaf0f464449c2 (diff) | |
download | ghostpdl-0996eae84c9c823c8b2346e14203f31099cdbbbe.tar.gz |
Bug 706466: Avoid NULL deref in file access code.
Check a function pointer is non-NULL before calling it.
Thanks to Youngseok Choi for the report.
Diffstat (limited to 'psi')
-rw-r--r-- | psi/zfile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/psi/zfile.c b/psi/zfile.c index 6ce7866e5..60c03554d 100644 --- a/psi/zfile.c +++ b/psi/zfile.c @@ -1174,6 +1174,10 @@ lib_file_open_search_with_combine(gs_file_path_ptr lib_path, const gs_memory_t return_error(gs_error_limitcheck); memcpy(buffer, pname.fname, pname.len); memcpy(buffer+pname.len, fname, flen); + if (pname.iodev->procs.open_file == NULL) { + code = 1; + continue; + } code = pname.iodev->procs.open_file(pname.iodev, buffer, pname.len + flen, fmode, &s, (gs_memory_t *)mem); if (code < 0) { |