]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
b5b499b3 | 2 | |
b5b499b3 FS |
3 | #include "alloc-util.h" |
4 | #include "fd-util.h" | |
673a1e6f | 5 | #include "fileio.h" |
b5b499b3 FS |
6 | #include "fuzz.h" |
7 | #include "nspawn-settings.h" | |
8 | ||
9 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | |
10 | _cleanup_fclose_ FILE *f = NULL; | |
11 | _cleanup_(settings_freep) Settings *s = NULL; | |
12 | ||
13 | if (size == 0) | |
14 | return 0; | |
15 | ||
673a1e6f | 16 | f = fmemopen_unlocked((char*) data, size, "re"); |
b5b499b3 FS |
17 | assert_se(f); |
18 | ||
19 | /* We don't want to fill the logs with messages about parse errors. | |
20 | * Disable most logging if not running standalone */ | |
21 | if (!getenv("SYSTEMD_LOG_LEVEL")) | |
22 | log_set_max_level(LOG_CRIT); | |
23 | ||
24 | (void) settings_load(f, "/dev/null", &s); | |
25 | ||
26 | return 0; | |
27 | } |