diff options
author | xkernel <xkernel.wang@foxmail.com> | 2022-10-20 00:40:25 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-10-24 10:00:27 +1100 |
commit | 3e9ce25c6a312300e446690e87b6231bedf727e0 (patch) | |
tree | 68fc7c900c03ea310aec4d6a32564cef89a0dd00 /apps/lib | |
parent | f713ec7d9d146194ca572f7b7f8cc3434119f400 (diff) |
Checking the return of BIO_new_fp(). If it returns NULL, then it is unnecessary to build the BIO chain and better make the caller directly return NULL
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)
(cherry picked from commit fb03e6145961005a6db011d2f36660d2eed734e2)
Diffstat (limited to 'apps/lib')
-rw-r--r-- | apps/lib/apps.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c index c501e32f3f..9456a21868 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -2936,6 +2936,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); @@ -2955,7 +2958,7 @@ BIO *dup_bio_err(int format) BIO *b = BIO_new_fp(stderr, 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; |