Mercurial > dropbear
annotate fuzzer-preauth.c @ 1357:08f4fa4dc6a0 fuzz
closer to working
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 20 May 2017 13:23:16 +0800 |
parents | 3677a510f545 |
children | 6b89eb92f872 |
rev | line source |
---|---|
1348 | 1 #include "fuzz.h" |
2 #include "dbrandom.h" | |
3 #include "session.h" | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
4 #include "fuzz-wrapfd.h" |
1348 | 5 |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
6 static void setup_fuzzer(void) { |
1348 | 7 svr_setup_fuzzer(); |
8 } | |
9 | |
10 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { | |
11 static int once = 0; | |
12 if (!once) { | |
13 setup_fuzzer(); | |
14 once = 1; | |
15 } | |
16 | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
17 if (fuzzer_set_input(Data, Size) == DROPBEAR_FAILURE) { |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
18 return 0; |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
19 } |
1348 | 20 |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
21 int fakesock = 1; |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
22 wrapfd_add(fakesock, fuzz.input, PLAIN); |
1348 | 23 |
24 if (setjmp(fuzz.jmp) == 0) { | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
25 svr_session(fakesock, fakesock); |
1348 | 26 } else { |
1357 | 27 TRACE(("dropbear_exit longjmped")) |
1348 | 28 // dropbear_exit jumped here |
29 } | |
30 | |
31 return 0; | |
32 } |