Skip to content
Snippets Groups Projects
Commit 1c94ea2b authored by Vladimír Čunát's avatar Vladimír Čunát Committed by Petr Špaček
Browse files

lua net.interfaces(): fix mac addresses

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.
parent 1f4e3124
Branches
Tags
1 merge request!804lua net.interfaces(): fix mac addresses
Pipeline #47689 canceled with stages
in 8 seconds
......@@ -240,11 +240,11 @@ static int net_interfaces(lua_State *L)
/* 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");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment