From ed6ac038bf4197b46a900701b90501435a4047f4 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Sun, 5 Apr 2026 09:23:46 -0400
Subject: [PATCH] Protect against a driver reporting a supply type with a
 trailing '-'.

---
 scheduler/printers.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/scheduler/printers.c
+++ b/scheduler/printers.c
@@ -2252,13 +2252,15 @@ cupsdSetPrinterAttr(
       type  = ippGetString(types, i, NULL);
 
       for (psptr = pstype; *type && psptr < (pstype + sizeof(pstype) - 1); type ++)
-        if (*type == '-')
+      {
+        if (*type == '-' && type[1])
 	{
 	  type ++;
 	  *psptr++ = (char)toupper(*type & 255);
 	}
 	else
 	  *psptr++ = *type;
+      }
       *psptr = '\0';
 
       snprintf(buffer, sizeof(buffer), "index=%d;class=%s;type=%s;unit=percent;maxcapacity=100;level=%d;colorantname=%s;", i + 1, strncmp(pstype, "waste", 5) ? "supplyThatIsConsumed" : "receptacleThatIsFilled", pstype, level, color);
