summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/dhcp-network.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-10 15:33:28 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-10 15:52:32 +0100
commitb5c474f69b473ba752ac9e63ff961f94341dc828 (patch)
tree8cc3f1e1432c965f5b00b26d46cc4d2149b48acd /src/libsystemd-network/dhcp-network.c
parenttree-wide: unsetenv cannot fail (diff)
downloadsystemd-b5c474f69b473ba752ac9e63ff961f94341dc828.tar.xz
systemd-b5c474f69b473ba752ac9e63ff961f94341dc828.zip
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.
Diffstat (limited to '')
-rw-r--r--src/libsystemd-network/dhcp-network.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c
index 6c82d5508e..656482bf83 100644
--- a/src/libsystemd-network/dhcp-network.c
+++ b/src/libsystemd-network/dhcp-network.c
@@ -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)