[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Fri May 4 22:15:38 UTC 2018


The branch master has been updated
       via  0d94212a046e87fafea6e83e8ea2b2a58db49979 (commit)
      from  c16ab9dc6303e42519559f6053bf7e4931203a79 (commit)


- Log -----------------------------------------------------------------
commit 0d94212a046e87fafea6e83e8ea2b2a58db49979
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri May 4 14:44:19 2018 +0200

    BIO_s_mem() write: Skip early when input length is zero
    
    When the input length is zero, just return zero early.  Otherwise,
    there's a small chance that memory allocation is engaged, fails and
    returns -1, which is a bit confusing when nothing should be written.
    
    Fixes #4782 #4827
    
    Reviewed-by: Ben Kaduk <kaduk at mit.edu>
    (Merged from https://github.com/openssl/openssl/pull/6175)

-----------------------------------------------------------------------

Summary of changes:
 crypto/bio/bss_mem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c
index 7678a1d..9881984 100644
--- a/crypto/bio/bss_mem.c
+++ b/crypto/bio/bss_mem.c
@@ -216,6 +216,8 @@ static int mem_write(BIO *b, const char *in, int inl)
         goto end;
     }
     BIO_clear_retry_flags(b);
+    if (inl == 0)
+        return 0;
     blen = bbm->readp->length;
     mem_buf_sync(b);
     if (BUF_MEM_grow_clean(bbm->buf, blen + inl) == 0)


More information about the openssl-commits mailing list