summaryrefslogtreecommitdiff
path: root/pdf/pdf_cmap.c
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2022-01-07 15:24:34 +0000
committerChris Liddell <chris.liddell@artifex.com>2022-01-10 14:42:36 +0000
commit0b4c27ca7d92c63ef70205064187ae99617a2f09 (patch)
tree55664618456d6f0389ba26a5db0d6e972271037b /pdf/pdf_cmap.c
parentf7dc952613f4e614fae5fe859a5b6a90e3e17bf7 (diff)
downloadghostpdl-0b4c27ca7d92c63ef70205064187ae99617a2f09.tar.gz
Change order of string bounds checking
to maybe placate coverity.
Diffstat (limited to 'pdf/pdf_cmap.c')
-rw-r--r--pdf/pdf_cmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pdf/pdf_cmap.c b/pdf/pdf_cmap.c
index 05d0d1a28..9799120cb 100644
--- a/pdf/pdf_cmap.c
+++ b/pdf/pdf_cmap.c
@@ -646,10 +646,10 @@ pdf_cmap_open_file(pdf_context *ctx, gs_string *cmap_name, byte **buf, int64_t *
const char *path_pfx = "CMap/";
fname[0] = '\0';
- strncat(fname, path_pfx, strlen(path_pfx));
- if (strlen(fname) + cmap_name->size >= gp_file_name_sizeof)
+ if (strlen(path_pfx) + cmap_name->size >= gp_file_name_sizeof)
return_error(gs_error_rangecheck);
+ strncat(fname, path_pfx, strlen(path_pfx));
strncat(fname, (char *)cmap_name->data, cmap_name->size);
code = pdfi_open_resource_file(ctx, (const char *)fname, (const int)strlen(fname), &s);
if (code >= 0) {