summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcl/pl/pjparse.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/pcl/pl/pjparse.c b/pcl/pl/pjparse.c
index ab8f91394..c0fd4e789 100644
--- a/pcl/pl/pjparse.c
+++ b/pcl/pl/pjparse.c
@@ -1791,12 +1791,24 @@ pjl_process_init(gs_memory_t * mem)
1791 pathlen = 0; 1791 pathlen = 0;
1792 if ((code = gp_getenv("PCLFONTSOURCE", (char *)0, &pathlen)) < 0) { 1792 if ((code = gp_getenv("PCLFONTSOURCE", (char *)0, &pathlen)) < 0) {
1793 char *path = 1793 char *path =
1794 (char *)gs_alloc_bytes(mem, pathlen, "pjl_font_path"); 1794 (char *)gs_alloc_bytes(mem, pathlen + 1, "pjl_font_path");
1795 /* if the allocation fails we use the pjl fontsource */ 1795 /* if the allocation fails we use the pjl fontsource */
1796 if (path == NULL) 1796 if (path == NULL)
1797 pjlstate->environment_font_path = NULL; 1797 pjlstate->environment_font_path = NULL;
1798 else { 1798 else {
1799 const char * const sepr = gp_file_name_separator();
1800 const int lsepr = strlen(sepr);
1799 gp_getenv("PCLFONTSOURCE", path, &pathlen); /* can't fail */ 1801 gp_getenv("PCLFONTSOURCE", path, &pathlen); /* can't fail */
1802
1803 /* We want to ensure a trailing "/" is present */
1804 if (gs_file_name_check_separator(path + (pathlen - (lsepr + 1)), lsepr, path + pathlen - 1) != 1) {
1805 strncat(path, gp_file_name_separator(), pathlen + 1);
1806 }
1807 code = gs_add_control_path(mem, gs_permit_file_reading, path);
1808 if (code < 0) {
1809 gs_free_object(mem, path, "pjl_font_path");
1810 goto fail1;
1811 }
1800 pjlstate->environment_font_path = path; 1812 pjlstate->environment_font_path = path;
1801 } 1813 }
1802 } else /* environmet variable does not exist use pjl fontsource */ 1814 } else /* environmet variable does not exist use pjl fontsource */