diff options
author | Colin Watson <cjwatson@debian.org> | 2018-10-19 21:29:01 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2018-10-20 22:54:15 +0100 |
commit | d80ebbf028196b2478beebf5a290b97f35e1eed9 (patch) | |
tree | 6666a5484923a26738675ff27a6186cfe15d4cad /regress/misc | |
parent | 4f5bbf3f11efeec65bbd56464b20a19bd250e5cc (diff) | |
parent | 1d2a55436d4b556269f42ad5f7e16608b5a8ed74 (diff) |
New upstream release (7.9p1)
Diffstat (limited to 'regress/misc')
-rw-r--r-- | regress/misc/fuzz-harness/Makefile | 7 | ||||
-rw-r--r-- | regress/misc/fuzz-harness/authopt_fuzz.cc | 33 |
2 files changed, 38 insertions, 2 deletions
diff --git a/regress/misc/fuzz-harness/Makefile b/regress/misc/fuzz-harness/Makefile index 8fbfc20c6..a2aa4441f 100644 --- a/regress/misc/fuzz-harness/Makefile +++ b/regress/misc/fuzz-harness/Makefile | |||
@@ -7,7 +7,7 @@ CXXFLAGS=-O2 -g -Wall -Wextra -I ../../.. $(FUZZ_FLAGS) | |||
7 | LDFLAGS=-L ../../.. -L ../../../openbsd-compat -g $(FUZZ_FLAGS) | 7 | LDFLAGS=-L ../../.. -L ../../../openbsd-compat -g $(FUZZ_FLAGS) |
8 | LIBS=-lssh -lopenbsd-compat -lcrypto $(FUZZ_LIBS) | 8 | LIBS=-lssh -lopenbsd-compat -lcrypto $(FUZZ_LIBS) |
9 | 9 | ||
10 | all: pubkey_fuzz sig_fuzz | 10 | all: pubkey_fuzz sig_fuzz authopt_fuzz |
11 | 11 | ||
12 | .cc.o: | 12 | .cc.o: |
13 | $(CXX) $(CXXFLAGS) -c $< -o $@ | 13 | $(CXX) $(CXXFLAGS) -c $< -o $@ |
@@ -18,5 +18,8 @@ pubkey_fuzz: pubkey_fuzz.o | |||
18 | sig_fuzz: sig_fuzz.o | 18 | sig_fuzz: sig_fuzz.o |
19 | $(CXX) -o $@ sig_fuzz.o $(LDFLAGS) $(LIBS) | 19 | $(CXX) -o $@ sig_fuzz.o $(LDFLAGS) $(LIBS) |
20 | 20 | ||
21 | authopt_fuzz: authopt_fuzz.o | ||
22 | $(CXX) -o $@ authopt_fuzz.o ../../../auth-options.o $(LDFLAGS) $(LIBS) | ||
23 | |||
21 | clean: | 24 | clean: |
22 | -rm -f *.o pubkey_fuzz sig_fuzz | 25 | -rm -f *.o pubkey_fuzz sig_fuzz authopt_fuzz |
diff --git a/regress/misc/fuzz-harness/authopt_fuzz.cc b/regress/misc/fuzz-harness/authopt_fuzz.cc new file mode 100644 index 000000000..a76d5a3f1 --- /dev/null +++ b/regress/misc/fuzz-harness/authopt_fuzz.cc | |||
@@ -0,0 +1,33 @@ | |||
1 | #include <stddef.h> | ||
2 | #include <stdio.h> | ||
3 | #include <stdint.h> | ||
4 | #include <string.h> | ||
5 | #include <stdlib.h> | ||
6 | |||
7 | extern "C" { | ||
8 | |||
9 | #include "auth-options.h" | ||
10 | |||
11 | int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) | ||
12 | { | ||
13 | char *cp = (char *)malloc(size + 1); | ||
14 | struct sshauthopt *opts = NULL, *merge = NULL, *add = sshauthopt_new(); | ||
15 | |||
16 | if (cp == NULL || add == NULL) | ||
17 | goto out; | ||
18 | memcpy(cp, data, size); | ||
19 | cp[size] = '\0'; | ||
20 | if ((opts = sshauthopt_parse(cp, NULL)) == NULL) | ||
21 | goto out; | ||
22 | if ((merge = sshauthopt_merge(opts, add, NULL)) == NULL) | ||
23 | goto out; | ||
24 | |||
25 | out: | ||
26 | free(cp); | ||
27 | sshauthopt_free(add); | ||
28 | sshauthopt_free(opts); | ||
29 | sshauthopt_free(merge); | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | } // extern "C" | ||