]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
icmp6-packet: check the alignment of struct nd_opt_hdr for safety
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 1 Mar 2024 00:21:55 +0000 (09:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 1 Mar 2024 00:44:45 +0000 (09:44 +0900)
Addresses https://github.com/systemd/systemd/pull/31492#discussion_r1507481748.

src/libsystemd-network/ndisc-protocol.c

index 39dcdcdfd81a1010f054205bd2f4da8b1aeed0a1..d1f0819e143344188cdec47a6302e29f33fc3c5d 100644 (file)
@@ -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;