libsystemd-network: add comment explaining unusual memory access

Inspired by coverity CID#1435984. I'm confused by the union definion every time I look at it...
Let's at least add a comment to help future readers.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-11-10 15:33:28 +01:00
parent 44ee03d111
commit b5c474f69b
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ static int _bind_raw_socket(int ifindex, union sockaddr_union *link,
.sll_hatype = htobe16(arp_type),
.sll_halen = bcast_addr_len,
};
memcpy(link->ll.sll_addr, bcast_addr, bcast_addr_len);
memcpy(link->ll.sll_addr, bcast_addr, bcast_addr_len); /* We may overflow link->ll. link->ll_buffer ensures we have enough space. */
r = bind(s, &link->sa, SOCKADDR_LL_LEN(link->ll));
if (r < 0)