diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-03-01 01:21:55 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-03-01 01:44:45 +0100 |
commit | bbb2a0fb4129a11df84059cbce326b05f18604c3 (patch) | |
tree | 5525ef938f59a2200d6461e2b6381105338125d3 /src/libsystemd-network | |
parent | Merge pull request #31492 from yuwata/icmp6-packet (diff) | |
download | systemd-bbb2a0fb4129a11df84059cbce326b05f18604c3.tar.xz systemd-bbb2a0fb4129a11df84059cbce326b05f18604c3.zip |
icmp6-packet: check the alignment of struct nd_opt_hdr for safety
Addresses https://github.com/systemd/systemd/pull/31492#discussion_r1507481748.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/ndisc-protocol.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libsystemd-network/ndisc-protocol.c b/src/libsystemd-network/ndisc-protocol.c index 39dcdcdfd8..d1f0819e14 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; |