summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexei.volkov.bugs%sun.com <devnull@localhost>2006-04-26 07:00:54 +0000
committeralexei.volkov.bugs%sun.com <devnull@localhost>2006-04-26 07:00:54 +0000
commiteac2c4332756d86efbf98e2a8f70b9884f964de9 (patch)
tree6bf06d6b498886a81333f4b6ae5194cb30977f0f
parent6d5be3545f4e27e4ae0b3694d76cf6a4d59586b0 (diff)
downloadnss-hg-eac2c4332756d86efbf98e2a8f70b9884f964de9.tar.gz
[Bug 334522] pk12util crash in SEC_PKCS12DecoderValidateBags. r=nelson
-rw-r--r--security/nss/lib/pkcs12/p12d.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/security/nss/lib/pkcs12/p12d.c b/security/nss/lib/pkcs12/p12d.c
index 2d4d29cae..68220e15d 100644
--- a/security/nss/lib/pkcs12/p12d.c
+++ b/security/nss/lib/pkcs12/p12d.c
@@ -543,15 +543,15 @@ sec_pkcs12_decoder_safe_contents_init_decode(SEC_PKCS12DecoderContext *p12dcx,
if(!p12dcx->safeContentsCnt) {
p12dcx->safeContentsList =
(sec_PKCS12SafeContentsContext**)PORT_ArenaZAlloc(p12dcx->arena,
- sizeof(sec_PKCS12SafeContentsContext *));
+ 2 * sizeof(sec_PKCS12SafeContentsContext *));
} else {
p12dcx->safeContentsList =
(sec_PKCS12SafeContentsContext **) PORT_ArenaGrow(p12dcx->arena,
p12dcx->safeContentsList,
- (p12dcx->safeContentsCnt *
- sizeof(sec_PKCS12SafeContentsContext *)),
- (1 + p12dcx->safeContentsCnt *
- sizeof(sec_PKCS12SafeContentsContext *)));
+ (1 + p12dcx->safeContentsCnt) *
+ sizeof(sec_PKCS12SafeContentsContext *),
+ (2 + p12dcx->safeContentsCnt) *
+ sizeof(sec_PKCS12SafeContentsContext *));
}
if(!p12dcx->safeContentsList) {
p12dcx->errorValue = SEC_ERROR_NO_MEMORY;
@@ -2721,7 +2721,7 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
{
SECStatus rv;
int i, noInstallCnt, probCnt, bagCnt, errorVal = 0;
- if(!p12dcx || p12dcx->error) {
+ if(!p12dcx || p12dcx->error || !p12dcx->safeBags) {
return SECFailure;
}