The branch OpenSSL_1_0_2-stable has been updated
       via  62cd6a8389128ec4dc5500bdd13889633c4a5ae0 (commit)
      from  b75dbf3c118aeee4b1a71f882eb30ba7cefba486 (commit)


- Log -----------------------------------------------------------------
commit 62cd6a8389128ec4dc5500bdd13889633c4a5ae0
Author: Bernd Edlinger <[email protected]>
Date:   Wed Feb 15 19:11:05 2017 +0100

    Fix possible memory leak in cryptodev_digest_update.
    
    Reviewed-by: Richard Levitte <[email protected]>
    Reviewed-by: Rich Salz <[email protected]>
    (Merged from https://github.com/openssl/openssl/pull/2639)

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

Summary of changes:
 crypto/engine/eng_cryptodev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index 2a2b95c..af59471 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -810,14 +810,15 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const 
void *data,
 
     if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
         /* if application doesn't support one buffer */
-        state->mac_data =
+        char *mac_data =
             OPENSSL_realloc(state->mac_data, state->mac_len + count);
 
-        if (!state->mac_data) {
+        if (mac_data == NULL) {
             printf("cryptodev_digest_update: realloc failed\n");
             return (0);
         }
 
+        state->mac_data = mac_data;
         memcpy(state->mac_data + state->mac_len, data, count);
         state->mac_len += count;
 
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to