From d1aec3bba775341df58cd4b2f03b6652a8bc80c6 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 5 Jun 2026 13:53:58 +0200 Subject: [PATCH] fuzz: Read environment variable to provide verbose logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub Jelen Reviewed-by: Pavol Žáčik Reviewed-by: Andreas Schneider Merge-Request: --- tests/fuzz/ssh_bind_config_fuzzer.c | 5 +++++ tests/fuzz/ssh_client_config_fuzzer.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/fuzz/ssh_bind_config_fuzzer.c b/tests/fuzz/ssh_bind_config_fuzzer.c index 0d519819..b42342c9 100644 --- a/tests/fuzz/ssh_bind_config_fuzzer.c +++ b/tests/fuzz/ssh_bind_config_fuzzer.c @@ -48,6 +48,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ssh_bind bind = NULL; char *input = NULL; + const char *env = NULL; input = (char *)malloc(size + 1); if (!input) { @@ -63,6 +64,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) goto out; } + env = getenv("LIBSSH_VERBOSITY"); + if (env != NULL && strlen(env) > 0) { + ssh_bind_options_set(bind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR, env); + } ssh_bind_config_parse_string(bind, input); ssh_bind_free(bind); diff --git a/tests/fuzz/ssh_client_config_fuzzer.c b/tests/fuzz/ssh_client_config_fuzzer.c index 5658b3e4..c6900365 100644 --- a/tests/fuzz/ssh_client_config_fuzzer.c +++ b/tests/fuzz/ssh_client_config_fuzzer.c @@ -47,6 +47,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ssh_session session = NULL; char *input = NULL; + const char *env = NULL; input = (char *)malloc(size+1); if (!input) { @@ -62,6 +63,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) goto out; } + env = getenv("LIBSSH_VERBOSITY"); + if (env != NULL && strlen(env) > 0) { + ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY_STR, env); + } /* Make sure we have default options set */ ssh_options_set(session, SSH_OPTIONS_SSH_DIR, NULL); ssh_options_set(session, SSH_OPTIONS_HOST, "example.com");