comparison 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
comparison
equal deleted inserted replaced
1767:3e1e1f82eba6 1768:096a66e45212
72 int dumping; 72 int dumping;
73 // the file descriptor 73 // the file descriptor
74 int recv_dumpfd; 74 int recv_dumpfd;
75 75
76 // avoid filling fuzzing logs, this points to /dev/null 76 // avoid filling fuzzing logs, this points to /dev/null
77 FILE *stderr; 77 FILE *fake_stderr;
78 }; 78 };
79 79
80 extern struct dropbear_fuzz_options fuzz; 80 extern struct dropbear_fuzz_options fuzz;
81 81
82 /* guard for when fuzz.h is included by fuzz-common.c */
83 #ifndef FUZZ_NO_REPLACE_STDERR
84
82 /* This is a bodge but seems to work. 85 /* This is a bodge but seems to work.
83 glibc stdio.h has the comment 86 glibc stdio.h has the comment
84 "C89/C99 say they're macros. Make them happy." */ 87 "C89/C99 say they're macros. Make them happy." */
88 /* OS X has it as a macro */
85 #ifdef stderr 89 #ifdef stderr
86 #undef stderr 90 #undef stderr
87 #endif 91 #endif
88 #define stderr (fuzz.stderr) 92 #define stderr (fuzz.fake_stderr)
93
94 #endif /* FUZZ_NO_REPLACE_STDERR */
89 95
90 #endif // DROPBEAR_FUZZ 96 #endif // DROPBEAR_FUZZ
91 97
92 #endif /* DROPBEAR_FUZZ_H */ 98 #endif /* DROPBEAR_FUZZ_H */