summaryrefslogtreecommitdiff
path: root/fuzz/gnutls_base64_decoder_fuzzer.c
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2017-08-05 20:49:19 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-16 09:41:27 +0200
commit5bb8a18b00cefb2b15221e766f9a87c506ca2932 (patch)
treee0554fa50fe3ac89adbc8478f72211ff61df1efc /fuzz/gnutls_base64_decoder_fuzzer.c
parentd2e49df8ebc1b3a7e3a28059c099174365e0a546 (diff)
downloadgnutls-5bb8a18b00cefb2b15221e766f9a87c506ca2932.tar.gz
fuzzer: Initial check in for improved fuzzing
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'fuzz/gnutls_base64_decoder_fuzzer.c')
-rw-r--r--fuzz/gnutls_base64_decoder_fuzzer.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fuzz/gnutls_base64_decoder_fuzzer.c b/fuzz/gnutls_base64_decoder_fuzzer.c
new file mode 100644
index 0000000000..d3aef8b3ab
--- /dev/null
+++ b/fuzz/gnutls_base64_decoder_fuzzer.c
@@ -0,0 +1,35 @@
+/*
+# Copyright 2017 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+*/
+
+#include <stdint.h>
+
+#include <gnutls/gnutls.h>
+#include "fuzzer.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ gnutls_datum_t raw = {.data = (unsigned char *)data, .size = size};
+ gnutls_datum_t out;
+ int ret;
+
+ ret = gnutls_pem_base64_decode2(NULL, &raw, &out);
+ if (ret >= 0)
+ gnutls_free(out.data);
+
+ return 0;
+}