diff svr-session.c @ 1348:5c2899e35b63 fuzz

fuzz harness
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 May 2017 22:50:54 +0800
parents b28624698130
children 3fdd8c5a0195
line wrap: on
line diff
--- a/svr-session.c	Fri May 12 23:14:54 2017 +0800
+++ b/svr-session.c	Sat May 13 22:50:54 2017 +0800
@@ -40,6 +40,7 @@
 #include "auth.h"
 #include "runopts.h"
 #include "crypto_desc.h"
+#include "fuzz.h"
 
 static void svr_remoteclosed(void);
 
@@ -182,6 +183,13 @@
 		session_cleanup();
 	}
 
+#ifdef DROPBEAR_FUZZ
+	// longjmp before cleaning up svr_opts
+    if (fuzz.fuzzing) {
+        longjmp(fuzz.jmp, 1);
+    }
+#endif
+
 	if (svr_opts.hostkey) {
 		sign_key_free(svr_opts.hostkey);
 		svr_opts.hostkey = NULL;
@@ -191,11 +199,6 @@
 		m_free(svr_opts.ports[i]);
 	}
 
-#ifdef DROPBEAR_FUZZ
-    if (opts.fuzz.fuzzing) {
-        longjmp(opts.fuzz.jmp, 1);
-    }
-#endif
     
 	exit(exitcode);