From: Yu Watanabe Date: Fri, 1 Mar 2024 00:21:55 +0000 (+0900) Subject: icmp6-packet: check the alignment of struct nd_opt_hdr for safety X-Git-Tag: v256-rc1~692^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbb2a0fb4129a11df84059cbce326b05f18604c3;p=thirdparty%2Fsystemd.git icmp6-packet: check the alignment of struct nd_opt_hdr for safety Addresses https://github.com/systemd/systemd/pull/31492#discussion_r1507481748. --- diff --git a/src/libsystemd-network/ndisc-protocol.c b/src/libsystemd-network/ndisc-protocol.c index 39dcdcdfd81..d1f0819e143 100644 --- a/src/libsystemd-network/ndisc-protocol.c +++ b/src/libsystemd-network/ndisc-protocol.c @@ -22,6 +22,7 @@ int ndisc_option_parse( if (p->raw_size - offset < sizeof(struct nd_opt_hdr)) return -EBADMSG; + assert_cc(alignof(struct nd_opt_hdr) == 1); const struct nd_opt_hdr *hdr = (const struct nd_opt_hdr*) (p->raw_packet + offset); if (hdr->nd_opt_len == 0) return -EBADMSG;