summaryrefslogtreecommitdiffstats
path: root/fuzz/server.c
diff options
context:
space:
mode:
authorMike Aizatsky <aizatsky@google.com>2016-10-26 22:56:39 +0200
committerKurt Roeckx <kurt@roeckx.be>2016-11-01 19:24:55 +0100
commitba7407002d899b614d4728da9004594f947ff3da (patch)
tree0d30e69ed0a8af3be37f64533662e36ccccabc48 /fuzz/server.c
parentFix grammar-o in CONTRIBUTING (diff)
downloadopenssl-ba7407002d899b614d4728da9004594f947ff3da.tar.xz
openssl-ba7407002d899b614d4728da9004594f947ff3da.zip
[fuzzers] do not fail fuzzers with empty input
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1788
Diffstat (limited to 'fuzz/server.c')
-rw-r--r--fuzz/server.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fuzz/server.c b/fuzz/server.c
index 0076306db9..35449d8caa 100644
--- a/fuzz/server.c
+++ b/fuzz/server.c
@@ -217,6 +217,12 @@ int FuzzerInitialize(int *argc, char ***argv) {
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len) {
+ SSL *server;
+ BIO *in;
+ BIO *out;
+ if (!len) {
+ return 0;
+ }
/* TODO: make this work for OpenSSL. There's a PREDICT define that may do
* the job.
* TODO: use the ossltest engine (optionally?) to disable crypto checks.
@@ -224,9 +230,9 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len) {
*/
/* This only fuzzes the initial flow from the client so far. */
- SSL *server = SSL_new(ctx);
- BIO *in = BIO_new(BIO_s_mem());
- BIO *out = BIO_new(BIO_s_mem());
+ server = SSL_new(ctx);
+ in = BIO_new(BIO_s_mem());
+ out = BIO_new(BIO_s_mem());
SSL_set_bio(server, in, out);
SSL_set_accept_state(server);
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);