Mercurial > dropbear
diff fuzz.h @ 1758:1365661f6be6
Disable stderr output for fuzzer by default
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Oct 2020 22:40:08 +0800 |
parents | 517fb7b62438 |
children | 096a66e45212 |
line wrap: on
line diff
--- a/fuzz.h Fri Oct 23 23:32:44 2020 +0800 +++ b/fuzz.h Sat Oct 24 22:40:08 2020 +0800 @@ -15,6 +15,10 @@ void fuzz_svr_setup(void); void fuzz_cli_setup(void); +// constructor attribute so it runs before main(), including +// in non-fuzzing mode. +void fuzz_early_setup(void) __attribute__((constructor)); + // must be called once per fuzz iteration. // returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE int fuzz_set_input(const uint8_t *Data, size_t Size); @@ -68,10 +72,21 @@ int dumping; // the file descriptor int recv_dumpfd; + + // avoid filling fuzzing logs, this points to /dev/null + FILE *stderr; }; extern struct dropbear_fuzz_options fuzz; +/* This is a bodge but seems to work. + glibc stdio.h has the comment + "C89/C99 say they're macros. Make them happy." */ +#ifdef stderr +#undef stderr +#endif +#define stderr (fuzz.stderr) + #endif // DROPBEAR_FUZZ #endif /* DROPBEAR_FUZZ_H */