if ((supplies[i].max_capacity > 0 || (quirks & CUPS_SNMP_CAPACITY)) &&
supplies[i].level >= 0)
- sprintf(ptr, "%d", percent);
+ snprintf(ptr, sizeof(value) - (ptr - value), "%d", percent);
else
- strcpy(ptr, "-1");
+ strlcpy(ptr, "-1", sizeof(value) - (ptr - value));
}
fprintf(stderr, "ATTR: marker-levels=%s\n", value);
"other",
"unknown",
"toner",
- "wasteToner",
+ "waste-toner",
"ink",
- "inkCartridge",
- "inkRibbon",
- "wasteInk",
+ "ink-cartridge",
+ "ink-ribbon",
+ "waste-ink",
"opc",
"developer",
- "fuserOil",
- "solidWax",
- "ribbonWax",
- "wasteWax",
+ "fuser-oil",
+ "solid-wax",
+ "ribbon-wax",
+ "waste-wax",
"fuser",
- "coronaWire",
- "fuserOilWick",
- "cleanerUnit",
- "fuserCleaningPad",
- "transferUnit",
- "tonerCartridge",
- "fuserOiler",
+ "corona-wire",
+ "fuser-oil-wick",
+ "cleaner-unit",
+ "fuser-cleaning-pad",
+ "transfer-unit",
+ "toner-cartridge",
+ "fuser-oiler",
"water",
- "wasteWater",
- "glueWaterAdditive",
- "wastePaper",
- "bindingSupply",
- "bandingSupply",
- "stitchingWire",
- "shrinkWrap",
- "paperWrap",
+ "waste-water",
+ "glue-water-additive",
+ "waste-paper",
+ "binding-supply",
+ "banding-supply",
+ "stitching-wire",
+ "shrink-wrap",
+ "paper-wrap",
"staples",
"inserts",
"covers"
*/
for (i = 0; i < num_supplies; i ++)
- strcpy(supplies[i].color, "none");
+ strlcpy(supplies[i].color, "none", sizeof(supplies[i].color));
_cupsSNMPWalk(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerColorantValue,
if (i)
*ptr++ = ',';
- strcpy(ptr, supplies[i].color);
+ strlcpy(ptr, supplies[i].color, sizeof(value) - (ptr - value));
}
fprintf(stderr, "ATTR: marker-colors=%s\n", value);
type = supplies[i].type;
if (type < CUPS_TC_other || type > CUPS_TC_covers)
- strcpy(ptr, "unknown");
+ strlcpy(ptr, "unknown", sizeof(value) - (ptr - value));
else
- strcpy(ptr, types[type - CUPS_TC_other]);
+ strlcpy(ptr, types[type - CUPS_TC_other], sizeof(value) - (ptr - value));
}
fprintf(stderr, "ATTR: marker-types=%s\n", value);
if (!_cups_strcasecmp(colors[k][0],
(char *)packet->object_value.string.bytes))
{
- strcpy(supplies[j].color, colors[k][1]);
+ strlcpy(supplies[j].color, colors[k][1], sizeof(supplies[j].color));
break;
}
}