diff options
author | Matt Johnston <matt@ucc.asn.au> | 2020-11-02 20:33:48 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2020-11-02 20:33:48 +0800 |
commit | 24cfda9e3c4257fa015963d7a0cf697270f37921 (patch) | |
tree | 5434bd6d18c532c5181e651db905054067b51921 | |
parent | 121e6e620269ff3eef7ef46d6ab7057e56317588 (diff) |
fuzzing - fix some wrong types and -lcrypt on macos
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | fuzz/fuzz-common.c | 4 | ||||
-rw-r--r-- | fuzz/fuzz-harness.c | 3 | ||||
-rw-r--r-- | fuzz/fuzz-sshpacketmutator.c | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in index 0476124..113a0fb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -290,7 +290,7 @@ fuzzstandalone: fuzz/fuzz-harness.o fuzz-targets fuzz-targets: $(FUZZ_TARGETS) $(FUZZER_OPTIONS) $(FUZZ_TARGETS): $(FUZZ_OBJS) $(allobjs) $(LIBTOM_DEPS) - $(CXX) $(CXXFLAGS) fuzz/$@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) -lcrypt + $(CXX) $(CXXFLAGS) fuzz/$@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@ # fuzzers that use the custom mutator - these expect a SSH network stream MUTATOR_FUZZERS=fuzzer-client fuzzer-client_nomaths \ diff --git a/fuzz/fuzz-common.c b/fuzz/fuzz-common.c index 3f8d081..18e8a29 100644 --- a/fuzz/fuzz-common.c +++ b/fuzz/fuzz-common.c @@ -239,7 +239,7 @@ int fuzz_run_preauth(const uint8_t *Data, size_t Size, int skip_kexmaths) { } uint32_t wrapseed; - genrandom(&wrapseed, sizeof(wrapseed)); + genrandom((void*)&wrapseed, sizeof(wrapseed)); wrapfd_setseed(wrapseed); int fakesock = wrapfd_new(); @@ -275,7 +275,7 @@ int fuzz_run_client(const uint8_t *Data, size_t Size, int skip_kexmaths) { ses.kexstate.donefirstkex = 1; uint32_t wrapseed; - genrandom(&wrapseed, sizeof(wrapseed)); + genrandom((void*)&wrapseed, sizeof(wrapseed)); wrapfd_setseed(wrapseed); int fakesock = wrapfd_new(); diff --git a/fuzz/fuzz-harness.c b/fuzz/fuzz-harness.c index 36905d6..331a88c 100644 --- a/fuzz/fuzz-harness.c +++ b/fuzz/fuzz-harness.c @@ -47,7 +47,8 @@ int main(int argc, char ** argv) { return 0; } -size_t LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize) { +// Just to let it link +size_t LLVMFuzzerMutate(uint8_t *UNUSED(Data), size_t UNUSED(Size), size_t UNUSED(MaxSize)) { printf("standalone fuzzer harness shouldn't call LLVMFuzzerMutate"); abort(); return 0; diff --git a/fuzz/fuzz-sshpacketmutator.c b/fuzz/fuzz-sshpacketmutator.c index 4ad60ef..d22dc07 100644 --- a/fuzz/fuzz-sshpacketmutator.c +++ b/fuzz/fuzz-sshpacketmutator.c @@ -285,7 +285,7 @@ size_t LLVMFuzzerCustomCrossOver(const uint8_t *Data1, size_t Size1, unsigned int num_out = min_out + nrand48(randstate) % (max_out-min_out+1); for (i = 0; i < num_out; i++) { - int choose = nrand48(randstate) % (num_packets1 + num_packets2); + unsigned int choose = nrand48(randstate) % (num_packets1 + num_packets2); buffer *p = NULL; if (choose < num_packets1) { p = packets1[choose]; |