Skip to content

Commit 79fde3a

Browse files
committed
Ethernet: fixed upcast of byte-pointer
1 parent c1cca1f commit 79fde3a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/Ethernet/src/Dhcp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,9 @@ uint8_t DhcpClass::parseDHCPResponse(unsigned long responseTimeout, uint32_t& tr
329329

330330
case dhcpServerIdentifier :
331331
opt_len = _dhcpUdpSocket.read();
332-
if( *((uint32_t*)_dhcpDhcpServerIp) == 0 ||
333-
IPAddress(_dhcpDhcpServerIp) == _dhcpUdpSocket.remoteIP() )
332+
if ((_dhcpDhcpServerIp[0] == 0 && _dhcpDhcpServerIp[1] == 0 &&
333+
_dhcpDhcpServerIp[2] == 0 && _dhcpDhcpServerIp[3] == 0) ||
334+
IPAddress(_dhcpDhcpServerIp) == _dhcpUdpSocket.remoteIP())
334335
{
335336
_dhcpUdpSocket.read(_dhcpDhcpServerIp, sizeof(_dhcpDhcpServerIp));
336337
}

0 commit comments

Comments
 (0)