Use initprogname(), not setprogname() in the fuzzers.

This results in better coverage for progname.c.
This commit is contained in:
Todd C. Miller
2022-12-29 15:52:21 -07:00
parent 206155e603
commit 91d7592e8a
8 changed files with 8 additions and 8 deletions

View File

@@ -96,7 +96,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
struct eventlog *evlog = NULL; struct eventlog *evlog = NULL;
FILE *fp; FILE *fp;
setprogname("fuzz_iolog_json"); initprogname("fuzz_iolog_json");
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -94,7 +94,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
struct eventlog *evlog = NULL; struct eventlog *evlog = NULL;
FILE *fp; FILE *fp;
setprogname("fuzz_iolog_legacy"); initprogname("fuzz_iolog_legacy");
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -77,7 +77,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
char logdir[] = "/tmp/timing.XXXXXX"; char logdir[] = "/tmp/timing.XXXXXX";
int dfd = -1, fd = -1; int dfd = -1, fd = -1;
setprogname("fuzz_iolog_timing"); initprogname("fuzz_iolog_timing");
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -76,7 +76,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
size_t nwritten; size_t nwritten;
int fd; int fd;
setprogname("fuzz_sudo_conf"); initprogname("fuzz_sudo_conf");
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -98,7 +98,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
size_t nwritten; size_t nwritten;
int fd; int fd;
setprogname("fuzz_logsrvd_conf"); initprogname("fuzz_logsrvd_conf");
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -266,7 +266,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
if (fp == NULL) if (fp == NULL)
return 0; return 0;
setprogname("fuzz_policy"); initprogname("fuzz_policy");
sudoers_debug_register(getprogname(), NULL); sudoers_debug_register(getprogname(), NULL);
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -208,7 +208,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
if (fp == NULL) if (fp == NULL)
return 0; return 0;
setprogname("fuzz_sudoers"); initprogname("fuzz_sudoers");
sudoers_debug_register(getprogname(), NULL); sudoers_debug_register(getprogname(), NULL);
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);

View File

@@ -132,7 +132,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
if (fp == NULL) if (fp == NULL)
return 0; return 0;
setprogname("fuzz_sudoers_ldif"); initprogname("fuzz_sudoers_ldif");
sudoers_debug_register(getprogname(), NULL); sudoers_debug_register(getprogname(), NULL);
if (getenv("SUDO_FUZZ_VERBOSE") == NULL) if (getenv("SUDO_FUZZ_VERBOSE") == NULL)
sudo_warn_set_conversation(fuzz_conversation); sudo_warn_set_conversation(fuzz_conversation);