diff options
author | Nils Larsch <nils@openssl.org> | 2005-07-26 20:55:17 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2005-07-26 20:55:17 +0000 |
commit | 3de6d65ea3cb3e8779494629260edc4b6874e2f8 (patch) | |
tree | 69eb243ccee1b02a2c4105576fcf060a06d249c6 /crypto/pkcs12/p12_crpt.c | |
parent | fdb0a6e0041a2ca941f1fc1084c028f73a9ef53b (diff) |
improved error checking and some fixes
PR: 1170
Submitted by: Yair Elharrar
Reviewed and edited by: Nils Larsch
Diffstat (limited to 'crypto/pkcs12/p12_crpt.c')
-rw-r--r-- | crypto/pkcs12/p12_crpt.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/pkcs12/p12_crpt.c b/crypto/pkcs12/p12_crpt.c index bbc13e50dd..3ad33c49d8 100644 --- a/crypto/pkcs12/p12_crpt.c +++ b/crypto/pkcs12/p12_crpt.c @@ -94,9 +94,14 @@ int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; /* Extract useful info from parameter */ + if (param == NULL || param->type != V_ASN1_SEQUENCE || + param->value.sequence == NULL) { + PKCS12err(PKCS12_F_PKCS12_PBE_KEYIVGEN,PKCS12_R_DECODE_ERROR); + return 0; + } + pbuf = param->value.sequence->data; - if (!param || (param->type != V_ASN1_SEQUENCE) || - !(pbe = d2i_PBEPARAM (NULL, &pbuf, param->value.sequence->length))) { + if (!(pbe = d2i_PBEPARAM(NULL, &pbuf, param->value.sequence->length))) { PKCS12err(PKCS12_F_PKCS12_PBE_KEYIVGEN,PKCS12_R_DECODE_ERROR); return 0; } |