summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r--src/dhcpv4.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index db5f138..35a3ad0 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -779,8 +779,10 @@ static void handle_dhcpv4(void *addr, void *data, size_t len,
}
}
- struct ifreq ifr = {.ifr_name = ""};
- strncpy(ifr.ifr_name, iface->ifname, sizeof(ifr.ifr_name));
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, iface->ifname, sizeof(ifr.ifr_name) - 1);
if (!ioctl(sock, SIOCGIFMTU, &ifr)) {
uint16_t mtu = htons(ifr.ifr_mtu);