summaryrefslogtreecommitdiffhomepage
path: root/fuzzer-preauth.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-01-23 23:05:47 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-01-23 23:05:47 +0800
commit89bdf3b0b9376204b039f38f8bebffa92cb30d4e (patch)
tree5a1a23f5ae301b599d1b0e9ccb23b0dcc3dbc1f4 /fuzzer-preauth.c
parent597f7eb5e921c70545d3f45e2b5e0b19867573e0 (diff)
add fuzzer-preauth_nomaths
--HG-- branch : fuzz
Diffstat (limited to 'fuzzer-preauth.c')
-rw-r--r--fuzzer-preauth.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/fuzzer-preauth.c b/fuzzer-preauth.c
index f7ced9d..3ac49f4 100644
--- a/fuzzer-preauth.c
+++ b/fuzzer-preauth.c
@@ -1,53 +1,6 @@
#include "fuzz.h"
-#include "session.h"
-#include "fuzz-wrapfd.h"
-#include "debug.h"
-
-static void setup_fuzzer(void) {
- svr_setup_fuzzer();
- //debug_trace = 1;
-}
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- static int once = 0;
- if (!once) {
- setup_fuzzer();
- once = 1;
- }
-
- if (fuzzer_set_input(Data, Size) == DROPBEAR_FAILURE) {
- return 0;
- }
-
- // get prefix. input format is
- // string prefix
- // uint32 wrapfd seed
- // ... to be extended later
- // [bytes] ssh input stream
-
- // be careful to avoid triggering buffer.c assertions
- if (fuzz.input->len < 8) {
- return 0;
- }
- size_t prefix_size = buf_getint(fuzz.input);
- if (prefix_size != 4) {
- return 0;
- }
- uint32_t wrapseed = buf_getint(fuzz.input);
- wrapfd_setseed(wrapseed);
-
- int fakesock = 20;
- wrapfd_add(fakesock, fuzz.input, PLAIN);
-
- m_malloc_set_epoch(1);
- if (setjmp(fuzz.jmp) == 0) {
- svr_session(fakesock, fakesock);
- m_malloc_free_epoch(1, 0);
- } else {
- m_malloc_free_epoch(1, 1);
- TRACE(("dropbear_exit longjmped"))
- // dropbear_exit jumped here
- }
-
- return 0;
+ return fuzz_run_preauth(Data, Size, 0);
}
+