diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2023-03-09 20:01:45 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2023-03-10 08:44:34 +0000 |
commit | 861d891df1091270cf72c090a653293be0f16d9f (patch) | |
tree | 7b32a00b8529943773b4a395063f843e05bcdcd8 | |
parent | 830902ba0e4bfbca2a1eb9d6b8268d04922c7729 (diff) | |
download | ghostpdl-861d891df1091270cf72c090a653293be0f16d9f.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.
-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) { |