summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2023-07-09 02:00:01 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2023-07-09 02:00:04 +0200
commit67fb8efdf782592c133726a1ab7bc6692259e385 (patch)
tree3c6b8ceb3322eee2a4826ebd6a116da8cbee51f8 /gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
parentb29bd4d35e26951c719f31fc505c7c2bc566b4e1 (diff)
gnu: ghostscript: Fix CVE-2023-36664.
* gnu/packages/ghostscript.scm (ghostscript/fixed): New variable. (ghostscript)[replacement]: Assign it to new field. * gnu/packages/patches/ghostscript-CVE-2023-36664.patch, gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch')
-rw-r--r--gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch b/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
new file mode 100644
index 0000000000..c2a222701f
--- /dev/null
+++ b/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
@@ -0,0 +1,56 @@
+From 0974e4f2ac0005d3731e0b5c13ebc7e965540f4d Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Wed, 14 Jun 2023 09:08:12 +0100
+Subject: [PATCH] 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.
+---
+ base/gpmisc.c | 2 +-
+ base/gslibctx.c | 4 ++--
+ 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,
+ /* "%pipe%" do not follow the normal rules for path definitions, so we
+ don't "reduce" them to avoid unexpected results
+ */
+- if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
++ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
+ bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path");
+ if (buffer == NULL)
+ 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
+ /* "%pipe%" do not follow the normal rules for path definitions, so we
+ don't "reduce" them to avoid unexpected results
+ */
+- if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
++ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
+ buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len");
+ if (buffer == NULL)
+ return gs_error_VMerror;
+@@ -850,7 +850,7 @@ gs_remove_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type,
+ /* "%pipe%" do not follow the normal rules for path definitions, so we
+ don't "reduce" them to avoid unexpected results
+ */
+- if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
++ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
+ buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_remove_control_path_len");
+ if (buffer == NULL)
+ return gs_error_VMerror;
+--
+2.34.1
+