libipsec: Fix compiler warning with GCC 9
authorTobias Brunner <tobias@strongswan.org>
Wed, 28 Aug 2019 07:53:19 +0000 (09:53 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 28 Aug 2019 09:10:49 +0000 (11:10 +0200)
The compiler complains that "taking address of packed member ... of
class or structure 'ip6_hdr' may result in an unaligned pointer value".
We don't care if the address is aligned as we explicitly use untoh16()
to convert the read value.

src/libipsec/ip_packet.c

index fee70c1..f4f3358 100644 (file)
@@ -335,7 +335,7 @@ ip_packet_t *ip_packet_create(chunk_t packet)
                        }
                        ip = (struct ip6_hdr*)packet.ptr;
                        /* remove any RFC 4303 TFC extra padding */
-                       packet.len = min(packet.len, 40 + untoh16(&ip->ip6_plen));
+                       packet.len = min(packet.len, 40 + untoh16((void*)&ip->ip6_plen));
                        if (!parse_transport_header_v6(ip, packet, &payload, &next_header,
                                                                                   &sport, &dport))
                        {