src/resolve/fuzz-etc-hosts.c
raw| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | |
| 3 | #include "fd-util.h" |
| 4 | #include "fuzz.h" |
| 5 | #include "resolved-etc-hosts.h" |
| 6 | |
| 7 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
| 8 | _cleanup_fclose_ FILE *f = NULL; |
| 9 | _cleanup_(etc_hosts_clear) EtcHosts h = {}; |
| 10 | |
| 11 | fuzz_setup_logging(); |
| 12 | |
| 13 | f = data_to_file(data, size); |
| 14 | assert_se(f); |
| 15 | |
| 16 | (void) etc_hosts_parse(&h, f); |
| 17 | |
| 18 | return 0; |
| 19 | } |