Mercurial > dropbear
diff fuzz/fuzz-common.c @ 1768:096a66e45212
Fix fuzzing stderr override on os x
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 26 Oct 2020 23:44:43 +0800 |
parents | 3e1e1f82eba6 |
children | 66b29b054896 |
line wrap: on
line diff
--- a/fuzz/fuzz-common.c Mon Oct 26 23:31:24 2020 +0800 +++ b/fuzz/fuzz-common.c Mon Oct 26 23:44:43 2020 +0800 @@ -1,7 +1,6 @@ #include "includes.h" #include "includes.h" -#include "fuzz.h" #include "dbutil.h" #include "runopts.h" #include "crypto_desc.h" @@ -11,8 +10,14 @@ #include "atomicio.h" #include "fuzz-wrapfd.h" +#define FUZZ_NO_REPLACE_STDERR +#include "fuzz.h" + /* fuzz.h redefines stderr, we don't want that here */ +#ifdef origstderr #undef stderr +#define stderr origstderr +#endif // origstderr struct dropbear_fuzz_options fuzz; @@ -23,7 +28,7 @@ // This runs automatically before main, due to contructor attribute in fuzz.h void fuzz_early_setup(void) { /* Set stderr to point to normal stderr by default */ - fuzz.stderr = stderr; + fuzz.fake_stderr = stderr; } void fuzz_common_setup(void) { @@ -50,8 +55,8 @@ else { fprintf(stderr, "Dropbear fuzzer: Disabling stderr output\n"); - fuzz.stderr = fopen("/dev/null", "w"); - assert(fuzz.stderr); + fuzz.fake_stderr = fopen("/dev/null", "w"); + assert(fuzz.fake_stderr); } }