From 4676888527db4b65ae43ee0eb0b64171918fe16b Mon Sep 17 00:00:00 2001 From: ManasBagul23 Date: Thu, 19 Nov 2026 20:04:56 +0530 Subject: [PATCH] libcups2: stop ppd_unquote() reading past a trailing backslash ppd_unquote() unescapes a .po/.strings value in place. When a value ends in a literal backslash just before the closing quote (the caller already stripped that quote and NUL-terminated the string there), the function advances past the backslash with "s++" and immediately dereferences *s again without checking whether that landed on the terminating NUL. Since there is nothing past the NUL for a value that ends right there, this reads one byte past the end of the string's allocation; reproduced a crash by placing such a string so its NUL lands on the last byte of a mapped page, with the next page unreadable. Stop and leave the backslash as the end of output if nothing follows it, instead of reading past the string. --- ppd/libcups2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ppd/libcups2.c b/ppd/libcups2.c index ad4f7146..e819d8fb 100644 --- a/ppd/libcups2.c +++ b/ppd/libcups2.c @@ -115,6 +115,10 @@ ppd_unquote(char *d, // O - Unquoted string if (*s == '\\') { s ++; + + if (!*s) + break; + if (isdigit(*s)) { *d = 0;