]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/fuzz/fuzz-calendarspec.c
license: LGPL-2.1+ -> LGPL-2.1-or-later
[thirdparty/systemd.git] / src / fuzz / fuzz-calendarspec.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "alloc-util.h"
4 #include "calendarspec.h"
5 #include "fd-util.h"
6 #include "fuzz.h"
7
8 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
9 _cleanup_(calendar_spec_freep) CalendarSpec *cspec = NULL;
10 _cleanup_free_ char *str = NULL, *p = NULL;
11
12 if (!getenv("SYSTEMD_LOG_LEVEL"))
13 log_set_max_level(LOG_CRIT);
14
15 str = memdup_suffix0(data, size);
16
17 if (calendar_spec_from_string(str, &cspec) >= 0) {
18 (void) calendar_spec_valid(cspec);
19 (void) calendar_spec_normalize(cspec);
20 (void) calendar_spec_to_string(cspec, &p);
21 }
22
23 return 0;
24 }