From bb19b9d4561228599b2259f6a4912066274ae622 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Sat, 12 Jun 2021 11:49:22 +0200 Subject: BIO_write_ex(): Make handing of BIO b == NULL and dlen == 0 less redundant Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15722) --- crypto/bio/bio_lib.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crypto') diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index af7ad05bca..a378f186d7 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -393,13 +393,8 @@ int BIO_write(BIO *b, const void *data, int dlen) int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written) { - if (dlen == 0) { - /* no error */ - if (written != NULL) - *written = 0; - return 1; - } - return bio_write_intern(b, data, dlen, written) > 0; + return bio_write_intern(b, data, dlen, written) > 0 + || (b != NULL && dlen == 0); /* order is important for *written */ } int BIO_puts(BIO *b, const char *buf) -- cgit v1.2.3