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:
71d5679
)
Set salt length after the malloc has succeeded
author
Alessandro Ghedini
<alessandro@ghedini.me>
Thu, 8 Oct 2015 12:39:58 +0000
(14:39 +0200)
committer
Richard Levitte
<levitte@openssl.org>
Fri, 23 Oct 2015 18:39:25 +0000
(20:39 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit
c2319cf9fce87a2e82efb6e58ced11a85190dc3d
)
crypto/pkcs12/p12_mutl.c
patch
|
blob
|
history
diff --git
a/crypto/pkcs12/p12_mutl.c
b/crypto/pkcs12/p12_mutl.c
index 5ab4bf290e142e9b1460991b358a35f5509f9448..a9277827ff2df57792398b5a9d45d93e973f8f69 100644
(file)
--- a/
crypto/pkcs12/p12_mutl.c
+++ b/
crypto/pkcs12/p12_mutl.c
@@
-173,11
+173,11
@@
int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
}
if (!saltlen)
saltlen = PKCS12_SALT_LEN;
- p12->mac->salt->length = saltlen;
- if (!(p12->mac->salt->data = OPENSSL_malloc(saltlen))) {
+ if ((p12->mac->salt->data = OPENSSL_malloc(saltlen)) == NULL) {
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
+ p12->mac->salt->length = saltlen;
if (!salt) {
if (RAND_pseudo_bytes(p12->mac->salt->data, saltlen) < 0)
return 0;