Debian Codegraph @

src/fuzz/fuzz-env-file.c

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include <stdio.h>
4
5 #include "env-file.h"
6 #include "fd-util.h"
7 #include "fuzz.h"
8 #include "strv.h"
9
10 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
11 _cleanup_fclose_ FILE *f = NULL;
12 _cleanup_strv_free_ char **rl = NULL, **rlp = NULL;
13
14 if (outside_size_range(size, 0, 65536))
15 return 0;
16
17 f = data_to_file(data, size);
18 assert_se(f);
19
20 fuzz_setup_logging();
21
22 (void) load_env_file(f, NULL, &rl);
23 assert_se(fseek(f, 0, SEEK_SET) == 0);
24 (void) load_env_file_pairs(f, NULL, &rlp);
25
26 return 0;
27 }