summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/gsfname.c')
-rw-r--r--base/gsfname.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/base/gsfname.c b/base/gsfname.c
index b8aadf21..37acd07c 100644
--- a/base/gsfname.c
+++ b/base/gsfname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
+/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -46,7 +46,8 @@ gs_parse_file_name(gs_parsed_file_name_t * pfn, const char *pname, uint len,
pdelim = memchr(pname + 1, '%', len - 1);
if (pdelim == NULL) /* %device */
dlen = len;
- else if (pdelim[1] == 0) { /* %device% */
+ /* gs strings aren't necessarily null terminated */
+ else if (pdelim[1] == 0 || pdelim - pname == len - 1) { /* %device% */
pdelim = NULL;
dlen = len;
} else {