Skip to content

Commit 39be07e

Browse files
committed
fix of bounds memset
1 parent 9e8a98c commit 39be07e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: src/Dhcp.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ int DhcpClass::beginWithDHCP(uint8_t *mac, unsigned long timeout, unsigned long
2626
void DhcpClass::reset_DHCP_lease()
2727
{
2828
// zero out _dhcpSubnetMask, _dhcpGatewayIp, _dhcpLocalIp, _dhcpDhcpServerIp, _dhcpDnsServerIp
29-
memset(_dhcpLocalIp, 0, 20);
29+
memset(_dhcpLocalIp, 0, sizeof(_dhcpLocalIp));
30+
memset(_dhcpSubnetMask, 0, sizeof(_dhcpSubnetMask));
31+
memset(_dhcpGatewayIp, 0, sizeof(_dhcpGatewayIp));
32+
memset(_dhcpDhcpServerIp, 0, sizeof(_dhcpDhcpServerIp));
33+
memset(_dhcpDnsServerIp, 0, sizeof(_dhcpDnsServerIp));
3034
}
31-
3235
//return:0 on error, 1 if request is sent and response is received
3336
int DhcpClass::request_DHCP_lease()
3437
{

0 commit comments

Comments
 (0)