Skip to content

Commit 70ac353

Browse files
committed
Protect against a driver reporting a supply type with a trailing '-'.
1 parent 9f19e1a commit 70ac353

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scheduler/printers.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2198,13 +2198,15 @@ cupsdSetPrinterAttr(
21982198
type = ippGetString(types, i, NULL);
21992199

22002200
for (psptr = pstype; *type && psptr < (pstype + sizeof(pstype) - 1); type ++)
2201-
if (*type == '-')
2201+
{
2202+
if (*type == '-' && type[1])
22022203
{
22032204
type ++;
22042205
*psptr++ = (char)toupper(*type & 255);
22052206
}
22062207
else
22072208
*psptr++ = *type;
2209+
}
22082210
*psptr = '\0';
22092211

22102212
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);

0 commit comments

Comments
 (0)