summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2023-06-14 09:08:12 +0100
committerChris Liddell <chris.liddell@artifex.com>2023-06-14 09:08:12 +0100
commit0974e4f2ac0005d3731e0b5c13ebc7e965540f4d (patch)
tree9dfd0be9c4958d89d3815f1a7b2494a2e6d67053
parent8aaf185be774107d315f4d5a43aff0e4c50f6092 (diff)
Bug 706778: 706761 revisit
Two problems with the original commit. The first a silly typo inverting the logic of a test. The second was forgetting that we actually actually validate two candidate strings for pipe devices. One with the expected "%pipe%" prefix, the other using the pipe character prefix: "|". This addresses both those.
-rw-r--r--base/gpmisc.c2
-rw-r--r--base/gslibctx.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/base/gpmisc.c b/base/gpmisc.c
index 58511270e..2b0064bea 100644
--- a/base/gpmisc.c
+++ b/base/gpmisc.c
@@ -1081,7 +1081,7 @@ gp_validate_path_len(const gs_memory_t *mem,
1081 /* "%pipe%" do not follow the normal rules for path definitions, so we 1081 /* "%pipe%" do not follow the normal rules for path definitions, so we
1082 don't "reduce" them to avoid unexpected results 1082 don't "reduce" them to avoid unexpected results
1083 */ 1083 */
1084 if (len > 5 && memcmp(path, "%pipe", 5) != 0) { 1084 if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
1085 bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path"); 1085 bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path");
1086 if (buffer == NULL) 1086 if (buffer == NULL)
1087 return gs_error_VMerror; 1087 return gs_error_VMerror;
diff --git a/base/gslibctx.c b/base/gslibctx.c
index d2a1aa91d..42af99090 100644
--- a/base/gslibctx.c
+++ b/base/gslibctx.c
@@ -743,7 +743,7 @@ gs_add_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, co
743 /* "%pipe%" do not follow the normal rules for path definitions, so we 743 /* "%pipe%" do not follow the normal rules for path definitions, so we
744 don't "reduce" them to avoid unexpected results 744 don't "reduce" them to avoid unexpected results
745 */ 745 */
746 if (len > 5 && memcmp(path, "%pipe", 5) != 0) { 746 if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
747 buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len"); 747 buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len");
748 if (buffer == NULL) 748 if (buffer == NULL)
749 return gs_error_VMerror; 749 return gs_error_VMerror;
@@ -850,7 +850,7 @@ gs_remove_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type,
850 /* "%pipe%" do not follow the normal rules for path definitions, so we 850 /* "%pipe%" do not follow the normal rules for path definitions, so we
851 don't "reduce" them to avoid unexpected results 851 don't "reduce" them to avoid unexpected results
852 */ 852 */
853 if (len > 5 && memcmp(path, "%pipe", 5) != 0) { 853 if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
854 buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_remove_control_path_len"); 854 buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_remove_control_path_len");
855 if (buffer == NULL) 855 if (buffer == NULL)
856 return gs_error_VMerror; 856 return gs_error_VMerror;