From e05b17bc2060b8289e9b259734419709ba5024ca Mon Sep 17 00:00:00 2001 From: "alexei.volkov.bugs%sun.com" Date: Thu, 18 May 2006 21:00:58 +0000 Subject: [PATCH] [Bug 337008] OOM crash [@ nssList_Add - STAN_InitTokenForSlotInfo - STAN_LoadDefaultNSS3TrustDomain][@ nssList_Clone - nssList_CreateIterator - STAN_LoadDefaultNSS3TrustDomain] Dereferencing possibly NULL "(td)->tokenList". r=nelson, sr=wtc --- security/nss/lib/pki/pki3hack.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/security/nss/lib/pki/pki3hack.c b/security/nss/lib/pki/pki3hack.c index 80a0591e1b3b..0bd32cc631b1 100644 --- a/security/nss/lib/pki/pki3hack.c +++ b/security/nss/lib/pki/pki3hack.c @@ -35,7 +35,7 @@ * ***** END LICENSE BLOCK ***** */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.86 $ $Date: 2005/03/04 04:32:04 $"; +static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.87 $ $Date: 2006/05/18 21:00:58 $"; #endif /* DEBUG */ /* @@ -149,6 +149,12 @@ STAN_LoadDefaultNSS3TrustDomain ( SECMOD_GetReadLock(moduleLock); NSSRWLock_LockWrite(td->tokensLock); td->tokenList = nssList_Create(td->arena, PR_TRUE); + if (!td->tokenList) { + NSSRWLock_UnlockWrite(td->tokensLock); + SECMOD_ReleaseReadLock(moduleLock); + NSSTrustDomain_Destroy(td); + return PR_FAILURE; + } for (mlp = SECMOD_GetDefaultModuleList(); mlp != NULL; mlp=mlp->next) { for (i=0; i < mlp->module->slotCount; i++) { STAN_InitTokenForSlotInfo(td, mlp->module->slots[i]);