third_party_cups/backport-CVE-2023-4504.patch
cai-zihua 10cba4267c fix CVE-2023-4504 Signed-off-by:caizihua1@huawei.com
Signed-off-by: cai-zihua <caizihua1@huawei.com>
2023-09-26 21:54:57 +08:00

26 lines
593 B
Diff

diff --git a/cups/raster-interpret.c b/cups/raster-interpret.c
index fbe52f37..c24388d2 100644
--- a/cups/raster-interpret.c
+++ b/cups/raster-interpret.c
@@ -1113,7 +1113,19 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */
cur ++;
- if (*cur == 'b')
+ /*
+ * Return NULL if we reached NULL terminator, a lone backslash
+ * is not a valid character in PostScript.
+ */
+
+ if (!*cur)
+ {
+ *ptr = NULL;
+
+ return (NULL);
+ }
+
+ if (*cur == 'b')
*valptr++ = '\b';
else if (*cur == 'f')
*valptr++ = '\f';