The branch OpenSSL_1_0_2-stable has been updated
       via  8dd55d9ee107337460e6a35b4ece234b4475e12d (commit)
      from  aed0ecb97c2d5329b5b5728c1e74fa63ce58ca8f (commit)


- Log -----------------------------------------------------------------
commit 8dd55d9ee107337460e6a35b4ece234b4475e12d
Author: Richard Levitte <levi...@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 <ka...@mit.edu>
    (Merged from https://github.com/openssl/openssl/pull/6175)
    
    (cherry picked from commit 0d94212a046e87fafea6e83e8ea2b2a58db49979)

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

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 b0394a9..6ccb8e2 100644
--- a/crypto/bio/bss_mem.c
+++ b/crypto/bio/bss_mem.c
@@ -188,6 +188,8 @@ static int mem_write(BIO *b, const char *in, int inl)
     }
 
     BIO_clear_retry_flags(b);
+    if (inl == 0)
+        return 0;
     blen = bm->length;
     if (BUF_MEM_grow_clean(bm, blen + inl) != (blen + inl))
         goto end;
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to