From d0d1ede191cbc8dfa1748990a052ef90f000b55b Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Fri, 5 Mar 2021 22:51:11 +0800 Subject: fuzz: fix crash in newtcpdirect(), don't close the channel too early --- netio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'netio.c') diff --git a/netio.c b/netio.c index dbba5cd..0d69d3a 100644 --- a/netio.c +++ b/netio.c @@ -179,12 +179,6 @@ struct dropbear_progress_connection *connect_remote(const char* remotehost, cons int err; struct addrinfo hints; -#if DROPBEAR_FUZZ - if (fuzz.fuzzing) { - return fuzz_connect_remote(remotehost, remoteport, cb, cb_data, bind_address, bind_port); - } -#endif - c = m_malloc(sizeof(*c)); c->remotehost = m_strdup(remotehost); c->remoteport = m_strdup(remoteport); @@ -194,6 +188,13 @@ struct dropbear_progress_connection *connect_remote(const char* remotehost, cons list_append(&ses.conn_pending, c); +#if DROPBEAR_FUZZ + if (fuzz.fuzzing) { + c->errstring = m_strdup("fuzzing connect_remote always fails"); + return c; + } +#endif + memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_UNSPEC; -- cgit v1.2.3