From b9cb75e8c5fa84f7837ea1a335381881d2227ca4 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 17 Oct 2015 12:25:36 +0100 Subject: [PATCH] Add __AFL_INIT() to uxplink to allow afl-fuzz to skip some startup overhead. --- unix/uxplink.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unix/uxplink.c b/unix/uxplink.c index 836a37a6..6d402c94 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -25,7 +25,7 @@ #define MAX_STDIN_BACKLOG 4096 -void *logctx; +static void *logctx; static struct termios orig_termios; @@ -992,6 +992,11 @@ int main(int argc, char **argv) /* nodelay is only useful if stdin is a terminal device */ int nodelay = conf_get_int(conf, CONF_tcp_nodelay) && isatty(0); + /* This is a good place for a fuzzer to fork us. */ +#ifdef __AFL_HAVE_MANUAL_CONTROL + __AFL_INIT(); +#endif + error = back->init(NULL, &backhandle, conf, conf_get_str(conf, CONF_host), conf_get_int(conf, CONF_port), -- 2.45.2