diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index ae7154548..1c2768a2b 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -246,7 +246,7 @@ FUZZ_POLICY_OBJS = fuzz_policy.o editor.lo env.lo env_pattern.lo gc.lo \ FUZZ_POLICY_CORPUS = $(srcdir)/regress/corpus/policy/policy.* -FUZZ_SUDOERS_OBJS = file.lo fuzz_sudoers.o fmtsudoers.lo parse.lo locale.lo \ +FUZZ_SUDOERS_OBJS = fuzz_sudoers.o fmtsudoers.lo parse.lo locale.lo \ stubs.o sudo_printf.o FUZZ_SUDOERS_CORPUS = $(top_srcdir)/examples/sudoers \ diff --git a/plugins/sudoers/regress/fuzz/fuzz_sudoers.c b/plugins/sudoers/regress/fuzz/fuzz_sudoers.c index 4380fabca..dda1819ca 100644 --- a/plugins/sudoers/regress/fuzz/fuzz_sudoers.c +++ b/plugins/sudoers/regress/fuzz/fuzz_sudoers.c @@ -127,6 +127,12 @@ log_warningx(int flags, const char *fmt, ...) return true; } +static int +sudo_fuzz_query(struct sudo_nss *nss, struct passwd *pw) +{ + return 0; +} + static FILE * open_data(const uint8_t *data, size_t size) { @@ -153,12 +159,11 @@ open_data(const uint8_t *data, size_t size) #endif } -extern struct sudo_nss sudo_nss_file; - int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char **u, *users[] = { "root", "millert", "operator", NULL }; + struct sudo_nss sudo_nss_fuzz; struct sudo_nss_list snl = TAILQ_HEAD_INITIALIZER(snl); struct sudoers_parse_tree parse_tree; struct interface_list *interfaces; @@ -244,9 +249,11 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) } /* Only one sudoers source, the sudoers file itself. */ - TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries); init_parse_tree(&parse_tree, user_host, user_shost); - sudo_nss_file.parse_tree = &parse_tree; + memset(&sudo_nss_fuzz, 0, sizeof(sudo_nss_fuzz)); + sudo_nss_fuzz.parse_tree = &parse_tree; + sudo_nss_fuzz.query = sudo_fuzz_query; + TAILQ_INSERT_TAIL(&snl, &sudo_nss_fuzz, entries); /* Initialize defaults and parse sudoers. */ init_defaults();