diff options
author | Matt Caswell <matt@openssl.org> | 2022-12-06 15:21:23 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-12-22 11:01:06 +0100 |
commit | 9e5bd8923bff3e4f0cbba05c7dadfe289c66eb6f (patch) | |
tree | 9f55339816176ebee7923c449a9f634e019bde06 /crypto/asn1/asn_mime.c | |
parent | Fix BIO_f_cipher() flushing (diff) | |
download | openssl-9e5bd8923bff3e4f0cbba05c7dadfe289c66eb6f.tar.xz openssl-9e5bd8923bff3e4f0cbba05c7dadfe289c66eb6f.zip |
Fix SMIME_crlf_copy() to properly report an error
If the BIO unexpectedly fails to flush then SMIME_crlf_copy() was not
correctly reporting the error. We modify it to properly propagate the
error condition.
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19918)
Diffstat (limited to 'crypto/asn1/asn_mime.c')
-rw-r--r-- | crypto/asn1/asn_mime.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 014e482e66..a26eac1731 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -515,6 +515,7 @@ int SMIME_crlf_copy(BIO *in, BIO *out, int flags) char eol; int len; char linebuf[MAX_SMLEN]; + int ret; /* * Buffer output so we don't write one line at a time. This is useful * when streaming as we don't end up with one OCTET STRING per line. @@ -552,9 +553,12 @@ int SMIME_crlf_copy(BIO *in, BIO *out, int flags) } } } - (void)BIO_flush(out); + ret = BIO_flush(out); BIO_pop(out); BIO_free(bf); + if (ret <= 0) + return 0; + return 1; } |