]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix heap overflow in array.c 1177/head
authorKirill Furman <kir.furman@gmail.com>
Mon, 24 Feb 2025 19:31:45 +0000 (22:31 +0300)
committerKirill Furman <kir.furman@gmail.com>
Mon, 24 Feb 2025 19:31:45 +0000 (22:31 +0300)
When delim variable has \0 value,
strchr() func switch end var to the end of string,
set it to \0 and shift to next byte, which causes
heap overflow when new cycle runs
Fixes #1176
Signed-off by Kirill Furman <kir.furman@gmail.com>

cups/array.c

index f870cf66487be9c2c7b055c56734ebb0dc1d2927..4d8df96c8ed67debc84243d2ea736bc40186e0ef 100644 (file)
@@ -109,7 +109,7 @@ cupsArrayAddStrings(cups_array_t *a,        // I - Array
 
   DEBUG_printf("_cupsArrayAddStrings(a=%p, s=\"%s\", delim='%c')", (void *)a, s, delim);
 
-  if (!a || !s || !*s)
+  if (!a || !s || !*s || delim == '\0')
   {
     DEBUG_puts("1_cupsArrayAddStrings: Returning 0");
     return (false);