comparison 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
comparison
equal deleted inserted replaced
1347:b28624698130 1348:5c2899e35b63
38 #include "tcpfwd.h" 38 #include "tcpfwd.h"
39 #include "service.h" 39 #include "service.h"
40 #include "auth.h" 40 #include "auth.h"
41 #include "runopts.h" 41 #include "runopts.h"
42 #include "crypto_desc.h" 42 #include "crypto_desc.h"
43 #include "fuzz.h"
43 44
44 static void svr_remoteclosed(void); 45 static void svr_remoteclosed(void);
45 46
46 struct serversession svr_ses; /* GLOBAL */ 47 struct serversession svr_ses; /* GLOBAL */
47 48
180 { 181 {
181 /* must be after we've done with username etc */ 182 /* must be after we've done with username etc */
182 session_cleanup(); 183 session_cleanup();
183 } 184 }
184 185
186 #ifdef DROPBEAR_FUZZ
187 // longjmp before cleaning up svr_opts
188 if (fuzz.fuzzing) {
189 longjmp(fuzz.jmp, 1);
190 }
191 #endif
192
185 if (svr_opts.hostkey) { 193 if (svr_opts.hostkey) {
186 sign_key_free(svr_opts.hostkey); 194 sign_key_free(svr_opts.hostkey);
187 svr_opts.hostkey = NULL; 195 svr_opts.hostkey = NULL;
188 } 196 }
189 for (i = 0; i < DROPBEAR_MAX_PORTS; i++) { 197 for (i = 0; i < DROPBEAR_MAX_PORTS; i++) {
190 m_free(svr_opts.addresses[i]); 198 m_free(svr_opts.addresses[i]);
191 m_free(svr_opts.ports[i]); 199 m_free(svr_opts.ports[i]);
192 } 200 }
193 201
194 #ifdef DROPBEAR_FUZZ
195 if (opts.fuzz.fuzzing) {
196 longjmp(opts.fuzz.jmp, 1);
197 }
198 #endif
199 202
200 exit(exitcode); 203 exit(exitcode);
201 204
202 } 205 }
203 206