Skip to content

Commit ed6ac03

Browse files
committed
Protect against a driver reporting a supply type with a trailing '-'.
1 parent 8bcb9c0 commit ed6ac03

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
@@ -2152,13 +2152,15 @@ cupsdSetPrinterAttr(
21522152
type = ippGetString(types, i, NULL);
21532153

21542154
for (psptr = pstype; *type && psptr < (pstype + sizeof(pstype) - 1); type ++)
2155-
if (*type == '-')
2155+
{
2156+
if (*type == '-' && type[1])
21562157
{
21572158
type ++;
21582159
*psptr++ = (char)toupper(*type & 255);
21592160
}
21602161
else
21612162
*psptr++ = *type;
2163+
}
21622164
*psptr = '\0';
21632165

21642166
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)