diff fuzz.h @ 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 1365661f6be6
children 97ad26e397a5
line wrap: on
line diff
--- a/fuzz.h	Mon Oct 26 23:31:24 2020 +0800
+++ b/fuzz.h	Mon Oct 26 23:44:43 2020 +0800
@@ -74,18 +74,24 @@
     int recv_dumpfd;
 
     // avoid filling fuzzing logs, this points to /dev/null
-    FILE *stderr;
+    FILE *fake_stderr;
 };
 
 extern struct dropbear_fuzz_options fuzz;
 
+/* guard for when fuzz.h is included by fuzz-common.c */
+#ifndef FUZZ_NO_REPLACE_STDERR
+
 /* This is a bodge but seems to work.
  glibc stdio.h has the comment 
  "C89/C99 say they're macros.  Make them happy." */
+/* OS X has it as a macro */
 #ifdef stderr
 #undef stderr
 #endif
-#define stderr (fuzz.stderr)
+#define stderr (fuzz.fake_stderr)
+
+#endif /* FUZZ_NO_REPLACE_STDERR */
 
 #endif // DROPBEAR_FUZZ