]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/fuzz/fuzz-nspawn-settings.c
Merge pull request #11897 from mrc0mmand/parallelize-TEST-24-UNIT-TESTS
[thirdparty/systemd.git] / src / fuzz / fuzz-nspawn-settings.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #include <errno.h>
4
5 #include "alloc-util.h"
6 #include "fd-util.h"
7 #include "fuzz.h"
8 #include "nspawn-settings.h"
9
10 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
11 _cleanup_fclose_ FILE *f = NULL;
12 _cleanup_(settings_freep) Settings *s = NULL;
13
14 if (size == 0)
15 return 0;
16
17 f = fmemopen((char*) data, size, "re");
18 assert_se(f);
19
20 /* We don't want to fill the logs with messages about parse errors.
21 * Disable most logging if not running standalone */
22 if (!getenv("SYSTEMD_LOG_LEVEL"))
23 log_set_max_level(LOG_CRIT);
24
25 (void) settings_load(f, "/dev/null", &s);
26
27 return 0;
28 }