diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-06-09 13:48:21 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-06-11 09:51:14 +0200 |
commit | 20778ea7dad8c4f659dbb5dfcb4fac896e51ed6a (patch) | |
tree | 209127cde7c9941dee849201e693569d8fd3d3f6 /crypto | |
parent | 451c2a95bd7b21677efedb7c4a8860d3178a5f65 (diff) |
BIO_write_ex: No error only on 0 bytes to write
Fixes #15682
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15672)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bio_lib.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index cdce122796..af7ad05bca 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -393,7 +393,13 @@ 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) { - return bio_write_intern(b, data, dlen, written) >= 0; + if (dlen == 0) { + /* no error */ + if (written != NULL) + *written = 0; + return 1; + } + return bio_write_intern(b, data, dlen, written) > 0; } int BIO_puts(BIO *b, const char *buf) |