diff --git a/ndhc/clientpacket.c b/ndhc/clientpacket.c index 96afc1e..8052f94 100644 --- a/ndhc/clientpacket.c +++ b/ndhc/clientpacket.c @@ -72,7 +72,7 @@ uint32_t random_xid(void) /* Initializes dhcp packet header for a -client- packet. */ static void init_header(struct dhcpMessage *packet, char type) { - memset(packet, 0, sizeof(struct dhcpMessage)); + memset(packet, 0, DHCP_SIZE); packet->op = BOOTREQUEST; /* client */ packet->htype = ETH_10MB; packet->hlen = ETH_10MB_LEN; diff --git a/ndhc/packet.c b/ndhc/packet.c index 3f6fbbe..17de8db 100644 --- a/ndhc/packet.c +++ b/ndhc/packet.c @@ -19,8 +19,8 @@ int get_packet(struct dhcpMessage *packet, int fd) { int bytes; - memset(packet, 0, sizeof(struct dhcpMessage)); - bytes = safe_read(fd, (char *)packet, sizeof(struct dhcpMessage)); + memset(packet, 0, DHCP_SIZE); + bytes = safe_read(fd, (char *)packet, DHCP_SIZE); if (bytes == -1) { log_line("Read on listen socket failed: %s", strerror(errno)); return -1;