/src/knot-dns/tests-fuzz/fuzz_dname_to_str.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 "libknot/dname.h" |
7 | | |
8 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
9 | 216 | { |
10 | | // Skip invalid dnames. |
11 | 216 | if (knot_dname_wire_check(data, data + size, NULL) <= 0) { |
12 | 42 | return 0; |
13 | 42 | } |
14 | | |
15 | | // Transform the input. |
16 | 174 | knot_dname_txt_storage_t txt; |
17 | 174 | (void)knot_dname_to_str(txt, (const knot_dname_t *)data, sizeof(txt)); |
18 | | |
19 | 174 | return 0; |
20 | 216 | } |