]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/fuzz/fuzz-calendarspec.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #include "alloc-util.h"
4 #include "calendarspec.h"
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
;
12 if (!getenv("SYSTEMD_LOG_LEVEL"))
13 log_set_max_level(LOG_CRIT
);
15 str
= memdup_suffix0(data
, size
);
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
);