p = (unsigned const char *)data;
- snprintf(buf, 255, "%s%04X: ", pad, 0);
+ snprintf(buf, sizeof(buf), "%s%04X: ", pad, 0);
for (i = 0; i < size; i++) {
snprintf(hex, 4, "%02X ", p[i]);
- strncat(buf, hex, strlen(hex));
+ strncat(buf, hex, sizeof(buf) - strlen(buf) - 1);
if ((i + 1) % 8 == 0) {
if ((i + 1) % 16 == 0) {