From: Tobias Brunner Date: Thu, 14 Sep 2017 17:33:07 +0000 (+0200) Subject: dhcp: Fix warning regarding unaligned pointer value due to packed struct X-Git-Tag: 5.6.1dr3~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e433d512f4b184d3591bd78be6d74b55a84d5d03;p=thirdparty%2Fstrongswan.git dhcp: Fix warning regarding unaligned pointer value due to packed struct We don't need to access this as uint32_t so just cast it to a char*. --- diff --git a/src/libcharon/plugins/dhcp/dhcp_socket.c b/src/libcharon/plugins/dhcp/dhcp_socket.c index 4f4e1ffe0f..7541c3b492 100644 --- a/src/libcharon/plugins/dhcp/dhcp_socket.c +++ b/src/libcharon/plugins/dhcp/dhcp_socket.c @@ -438,7 +438,7 @@ METHOD(dhcp_socket_t, release, void, DBG1(DBG_CFG, "sending DHCP RELEASE for %H to %H", release, server); chunk = release->get_address(release); - memcpy(&dhcp.client_address, chunk.ptr, + memcpy((char*)&dhcp.client_address, chunk.ptr, min(chunk.len, sizeof(dhcp.client_address))); option = (dhcp_option_t*)&dhcp.options[optlen];