From cf2c4f44a2476172866f2d460ede18c0ea015968 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Thu, 25 May 2017 00:12:07 +0800 Subject: fuzzers disable logging by default --HG-- branch : fuzz --- fuzz-common.c | 14 +++++++++++++- fuzz-harness.c | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fuzz-common.c b/fuzz-common.c index 42f6aab..d5fc9db 100644 --- a/fuzz-common.c +++ b/fuzz-common.c @@ -11,12 +11,14 @@ struct dropbear_fuzz_options fuzz; +static void fuzz_dropbear_log(int UNUSED(priority), const char* format, va_list param); static void load_fixed_hostkeys(void); void common_setup_fuzzer(void) { fuzz.fuzzing = 1; fuzz.wrapfds = 1; fuzz.input = m_malloc(sizeof(buffer)); + _dropbear_log = fuzz_dropbear_log; crypto_init(); } @@ -52,6 +54,17 @@ int fuzzer_set_input(const uint8_t *Data, size_t Size) { return DROPBEAR_SUCCESS; } +static void fuzz_dropbear_log(int UNUSED(priority), const char* format, va_list param) { + + char printbuf[1024]; + +#if DEBUG_TRACE + if (debug_trace) { + vsnprintf(printbuf, sizeof(printbuf), format, param); + fprintf(stderr, "%s\n", printbuf); + } +#endif +} void svr_setup_fuzzer(void) { struct passwd *pw; @@ -59,7 +72,6 @@ void svr_setup_fuzzer(void) { common_setup_fuzzer(); _dropbear_exit = svr_dropbear_exit; - _dropbear_log = svr_dropbear_log; char *argv[] = { "-E", diff --git a/fuzz-harness.c b/fuzz-harness.c index 41bd946..8f370ca 100644 --- a/fuzz-harness.c +++ b/fuzz-harness.c @@ -12,6 +12,7 @@ int main(int argc, char ** argv) { #if DEBUG_TRACE if (strcmp(argv[i], "-v") == 0) { debug_trace = 1; + TRACE(("debug printing on")) } #endif } -- cgit v1.2.3