projects
/
oweals
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0baae1c
)
Don't call memcpy with NULL as source
author
Kurt Roeckx
<kurt@roeckx.be>
Thu, 15 Dec 2016 19:23:52 +0000
(20:23 +0100)
committer
Kurt Roeckx
<kurt@roeckx.be>
Thu, 15 Dec 2016 20:47:21 +0000
(21:47 +0100)
Calling it with lenght 0 and NULL as source is undefined behaviour.
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2089
(cherry picked from commit
eeab356c298248108b82157ef51172ba040646f7
)
crypto/bn/bn_intern.c
patch
|
blob
|
history
diff --git
a/crypto/bn/bn_intern.c
b/crypto/bn/bn_intern.c
index 9227b6e2415998a9e619b84eb74337eaaa38700a..2c970647defd5efec7d925c92f8daad61671f748 100644
(file)
--- 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;
}