fuzz: check that ND options are parsed sucessfully
authorEvgeny Vereshchagin <evvers@ya.ru>
Wed, 3 Apr 2024 13:55:31 +0000 (13:55 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Apr 2024 17:42:21 +0000 (02:42 +0900)
At that point the options have been parsed, sent and received again so
`ndisc_parse_options` should never fail there (unless ndisc_send corrupts
them somehow).

It's a follow-up to https://github.com/systemd/systemd/pull/31807

src/libsystemd-network/fuzz-ndisc-rs.c

index 8a720e628e9afb6f150cb1aae16bf0078c8a1c0e..c52043a13b35ae5eb6003d8499d21fb9f5c0619f 100644 (file)
@@ -62,7 +62,7 @@ static void test_with_icmp6_packet(const uint8_t *data, size_t size) {
         if (icmp6_packet_receive(fd_pair[0], &packet) < 0)
                 return;
 
-        (void) ndisc_parse_options(packet, &options);
+        assert_se(ndisc_parse_options(packet, &options) >= 0);
 }
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {