[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Wed Aug 24 09:36:23 UTC 2016


The branch master has been updated
       via  9e421962e1cd58e302ebd8aca5d5a44198194243 (commit)
      from  44cb4f5b5f0cee7e177aa8fc214b992f016fa8f0 (commit)


- Log -----------------------------------------------------------------
commit 9e421962e1cd58e302ebd8aca5d5a44198194243
Author: Andy Polyakov <appro at openssl.org>
Date:   Tue Aug 23 13:31:36 2016 +0200

    evp/bio_enc.c: stop using pointer arithmetic for error detection.
    
    Thanks to David Benjamin for reporting this.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>

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

Summary of changes:
 crypto/evp/bio_enc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c
index e3aaadb..5a3beef 100644
--- a/crypto/evp/bio_enc.c
+++ b/crypto/evp/bio_enc.c
@@ -148,9 +148,12 @@ static int enc_read(BIO *b, char *out, int outl)
 
         if (ctx->read_start == ctx->read_end) { /* time to read more data */
             ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
-            ctx->read_end += BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
+            i = BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
+            if (i > 0)
+                ctx->read_end += i;
+        } else {
+            i = ctx->read_end - ctx->read_start;
         }
-        i = ctx->read_end - ctx->read_start;
 
         if (i <= 0) {
             /* Should be continue next time we are called? */


More information about the openssl-commits mailing list