From: Dr. David von Oheimb Date: Mon, 14 Apr 2025 09:22:30 +0000 (+0200) Subject: PEM_write_bio_ASN1_stream(): complete I/O error checking X-Git-Tag: openssl-3.6.0-alpha1~751 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7084d167aae16ad7f7a69c3907ba284665b458bf;p=thirdparty%2Fopenssl.git PEM_write_bio_ASN1_stream(): complete I/O error checking Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/27368) --- diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 40221d39012..22d4d137b7c 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -128,11 +128,9 @@ static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags, int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, const char *hdr, const ASN1_ITEM *it) { - int r; - BIO_printf(out, "-----BEGIN %s-----\n", hdr); - r = B64_write_ASN1(out, val, in, flags, it); - BIO_printf(out, "-----END %s-----\n", hdr); - return r; + return BIO_printf(out, "-----BEGIN %s-----\n", hdr) >= 0 + && B64_write_ASN1(out, val, in, flags, it) + && BIO_printf(out, "-----END %s-----\n", hdr) >= 0; } static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it, ASN1_VALUE **x,