fuzz/asn1parse: Use BIO_s_mem() as fallback output
authorTomas Mraz <tomas@openssl.org>
Thu, 10 Jun 2021 14:55:37 +0000 (16:55 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 11 Jun 2021 07:51:14 +0000 (09:51 +0200)
/dev/null is not available everywhere.

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15672)

fuzz/asn1parse.c

index ac888e535ae11dcc92a4170b2dbbed281d6153a4..72b0df8a461063faa2997a3fcd6d1e529cb1dc3c 100644 (file)
@@ -24,6 +24,8 @@ static BIO *bio_out;
 int FuzzerInitialize(int *argc, char ***argv)
 {
     bio_out = BIO_new_file("/dev/null", "w");
+    if (bio_out == NULL)
+        bio_out = BIO_new(BIO_s_mem());
     OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
     ERR_clear_error();
     CRYPTO_free_ex_index(0, -1);