/src/knot-dns/tests-fuzz/fuzz_packet.c
Line | Count | Source |
1 | | /* Copyright (C) CZ.NIC, z.s.p.o. and contributors |
2 | | * SPDX-License-Identifier: GPL-2.0-or-later |
3 | | * For more information, see <https://www.knot-dns.cz/> |
4 | | */ |
5 | | |
6 | | #include <stdint.h> |
7 | | |
8 | | #include "libknot/packet/pkt.h" |
9 | | |
10 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
11 | 1.81k | { |
12 | 1.81k | uint8_t copy[1 + size]; |
13 | 1.81k | memcpy(copy, data, size); |
14 | | |
15 | 1.81k | knot_pkt_t *pkt = knot_pkt_new(copy, size, NULL); |
16 | 1.81k | if (pkt != NULL) { |
17 | 1.81k | knot_pkt_parse(pkt, 0); |
18 | 1.81k | knot_pkt_free(pkt); |
19 | 1.81k | } |
20 | | |
21 | 1.81k | return 0; |
22 | 1.81k | } |