Add missing NULL check in OSSL_DECODER_from_bio().
authorShane Lontis <shane.lontis@oracle.com>
Mon, 14 Jun 2021 06:43:28 +0000 (16:43 +1000)
committerPauli <pauli@openssl.org>
Tue, 15 Jun 2021 07:36:42 +0000 (17:36 +1000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15733)

crypto/encode_decode/decoder_lib.c

index 4053eac62e810aea8874014c70a175048b1231ab..c637b5bfefe7ec920208fe5bcb61e4fe1d1abfe9 100644 (file)
@@ -48,6 +48,11 @@ int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in)
     int ok = 0;
     BIO *new_bio = NULL;
 
+    if (in == NULL) {
+        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
+        return 0;
+    }
+
     if (OSSL_DECODER_CTX_get_num_decoders(ctx) == 0) {
         ERR_raise_data(ERR_LIB_OSSL_DECODER, OSSL_DECODER_R_DECODER_NOT_FOUND,
                        "No decoders were found. For standard decoders you need "