From ad8dedd4a481a48a51b2fed7371bc7073f0f31bd Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Wed, 29 Apr 2020 15:57:02 +0200 Subject: [PATCH] fuzz: Allow to increase log level from server fuzzer Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- tests/fuzz/ssh_server_fuzzer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/fuzz/ssh_server_fuzzer.cpp b/tests/fuzz/ssh_server_fuzzer.cpp index 6796ac8e..b96d46bc 100644 --- a/tests/fuzz/ssh_server_fuzzer.cpp +++ b/tests/fuzz/ssh_server_fuzzer.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int socket_fds[2] = {-1, -1}; ssize_t nwritten; bool no = false; + const char *env = NULL; int rc; /* Our struct holding information about the session. */ @@ -156,6 +158,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) ssh_session session = ssh_new(); assert(session != NULL); + + env = getenv("LIBSSH_VERBOSITY"); + if (env != NULL && strlen(env) > 0) { + rc = ssh_bind_options_set(sshbind, + SSH_BIND_OPTIONS_LOG_VERBOSITY_STR, + env); + assert(rc == 0); + } rc = ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, "/tmp/libssh_fuzzer_private_key");