]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Checking the return of BIO_new_fp(). If it returns NULL, then it is unnecessary to...
authorxkernel <xkernel.wang@foxmail.com>
Wed, 19 Oct 2022 16:40:25 +0000 (00:40 +0800)
committerPauli <pauli@openssl.org>
Sun, 23 Oct 2022 22:59:59 +0000 (09:59 +1100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19445)

apps/lib/apps.c

index b51afba8983660af6db8bc1f299f44920bb1c368..3d52e030ab7e258f9cd983b2d9755d954cb3aee5 100644 (file)
@@ -2972,6 +2972,9 @@ BIO *dup_bio_out(int format)
                         BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
     void *prefix = NULL;
 
+    if (b == NULL)
+        return NULL;
+
 #ifdef OPENSSL_SYS_VMS
     if (FMT_istext(format))
         b = BIO_push(BIO_new(BIO_f_linebuffer()), b);
@@ -2992,7 +2995,7 @@ BIO *dup_bio_err(int format)
                         BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
 
 #ifdef OPENSSL_SYS_VMS
-    if (FMT_istext(format))
+    if (b != NULL && FMT_istext(format))
         b = BIO_push(BIO_new(BIO_f_linebuffer()), b);
 #endif
     return b;