diff options
Diffstat (limited to 'regress/misc/fuzz-harness/sshsigopt_fuzz.cc')
-rw-r--r-- | regress/misc/fuzz-harness/sshsigopt_fuzz.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/regress/misc/fuzz-harness/sshsigopt_fuzz.cc b/regress/misc/fuzz-harness/sshsigopt_fuzz.cc new file mode 100644 index 000000000..7424fcbe3 --- /dev/null +++ b/regress/misc/fuzz-harness/sshsigopt_fuzz.cc | |||
@@ -0,0 +1,29 @@ | |||
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 "sshsig.h" | ||
10 | |||
11 | int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) | ||
12 | { | ||
13 | char *cp = (char *)malloc(size + 1); | ||
14 | struct sshsigopt *opts = NULL; | ||
15 | |||
16 | if (cp == NULL) | ||
17 | goto out; | ||
18 | memcpy(cp, data, size); | ||
19 | cp[size] = '\0'; | ||
20 | if ((opts = sshsigopt_parse(cp, "libfuzzer", 0, NULL)) == NULL) | ||
21 | goto out; | ||
22 | |||
23 | out: | ||
24 | free(cp); | ||
25 | sshsigopt_free(opts); | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | } // extern "C" | ||