Debian Codegraph @

src/boot/fuzz-efi-osrel.c

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "alloc-util.h"
4 #include "efi-string.h"
5 #include "fuzz.h"
6
7 #define SEP_LEN 4
8
9 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
10 if (outside_size_range(size, SEP_LEN + 1, 64 * 1024))
11 return 0;
12 if (data[SEP_LEN] != '\0')
13 return 0;
14
15 fuzz_setup_logging();
16
17 _cleanup_free_ char *p = memdup_suffix0(data + SEP_LEN + 1, size - SEP_LEN - 1);
18 assert_se(p);
19
20 size_t pos = 0;
21 char *key, *value;
22 while (line_get_key_value(p, (const char *) data, &pos, &key, &value)) {
23 assert_se(key);
24 assert_se(value);
25 }
26
27 return 0;
28 }