The branch master has been updated
       via  eeab356c298248108b82157ef51172ba040646f7 (commit)
      from  1ea01427c5195dafa4f00202237c5b7a389f034b (commit)


- Log -----------------------------------------------------------------
commit eeab356c298248108b82157ef51172ba040646f7
Author: Kurt Roeckx <[email protected]>
Date:   Thu Dec 15 20:23:52 2016 +0100

    Don't call memcpy with NULL as source
    
    Calling it with lenght 0 and NULL as source is undefined behaviour.
    
    Reviewed-by: Rich Salz <[email protected]>
    GH: #2089

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

Summary of changes:
 crypto/bn/bn_intern.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/bn/bn_intern.c b/crypto/bn/bn_intern.c
index 9227b6e..2c97064 100644
--- a/crypto/bn/bn_intern.c
+++ b/crypto/bn/bn_intern.c
@@ -167,7 +167,8 @@ int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size)
         return 0;
 
     memset(out, 0, sizeof(*out) * size);
-    memcpy(out, in->d, sizeof(*out) * in->top);
+    if (in->d != NULL)
+        memcpy(out, in->d, sizeof(*out) * in->top);
     return 1;
 }
 
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to