[openssh-commits] [openssh] 02/03: really add source for authopt_fuzz this time

git+noreply at mindrot.org git+noreply at mindrot.org
Sat Sep 15 19:38:29 AEST 2018


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 4488ae1a6940af704c4dbf70f55bf2f756a16536
Author: Damien Miller <djm at mindrot.org>
Date:   Sat Sep 15 19:36:55 2018 +1000

    really add source for authopt_fuzz this time
---
 regress/misc/fuzz-harness/authopt_fuzz.cc | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/regress/misc/fuzz-harness/authopt_fuzz.cc b/regress/misc/fuzz-harness/authopt_fuzz.cc
new file mode 100644
index 00000000..a76d5a3f
--- /dev/null
+++ b/regress/misc/fuzz-harness/authopt_fuzz.cc
@@ -0,0 +1,33 @@
+#include <stddef.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+extern "C" {
+
+#include "auth-options.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+	char *cp = (char *)malloc(size + 1);
+	struct sshauthopt *opts = NULL, *merge = NULL, *add = sshauthopt_new();
+
+	if (cp == NULL || add == NULL)
+		goto out;
+	memcpy(cp, data, size);
+	cp[size] = '\0';
+	if ((opts = sshauthopt_parse(cp, NULL)) == NULL)
+		goto out;
+	if ((merge = sshauthopt_merge(opts, add, NULL)) == NULL)
+		goto out;
+
+ out:
+	free(cp);
+	sshauthopt_free(add);
+	sshauthopt_free(opts);
+	sshauthopt_free(merge);
+	return 0;
+}
+
+} // extern "C"

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list