aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2016-12-15 20:23:52 +0100
committerKurt Roeckx <kurt@roeckx.be>2016-12-15 21:45:25 +0100
commiteeab356c298248108b82157ef51172ba040646f7 (patch)
tree08787dba1cf5bb3fe5ea0b935d31310e58b3f5d5 /crypto/bn
parent1ea01427c5195dafa4f00202237c5b7a389f034b (diff)
downloadopenssl-eeab356c298248108b82157ef51172ba040646f7.tar.gz
Don't call memcpy with NULL as source
Calling it with lenght 0 and NULL as source is undefined behaviour. Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #2089
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_intern.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/bn/bn_intern.c b/crypto/bn/bn_intern.c
index 9227b6e241..2c970647de 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;
}