Only the first byte was being shown since
3ab77332.
I can't see at all why this part was changed;
the buffer is (and was) way overlong for this,
so writing one zero byte just after the end is OK.
/* Hardware address. */
char *p = buf;
- memset(buf, 0, sizeof(buf));
- for (unsigned k = 0; k < sizeof(iface.phys_addr); ++k) {
- sprintf(p, "%s%.2x", k > 0 ? ":" : "", iface.phys_addr[k] & 0xff);
+ for (int k = 0; k < sizeof(iface.phys_addr); ++k) {
+ sprintf(p, "%.2x:", (uint8_t)iface.phys_addr[k]);
p += 3;
}
+ p[-1] = '\0';
lua_pushstring(L, buf);
lua_setfield(L, -2, "mac");