Fix for 240361 - crash in CERT_CheckValidTimes
git-svn-id: svn://10.0.0.236/trunk@156219 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
ae78396cc9
commit
5e7e772f3a
@ -37,7 +37,7 @@
|
||||
/*
|
||||
* Certificate handling code
|
||||
*
|
||||
* $Id: certdb.c,v 1.67 2004-05-05 01:15:39 jpierre%netscape.com Exp $
|
||||
* $Id: certdb.c,v 1.68 2004-05-11 02:43:09 jpierre%netscape.com Exp $
|
||||
*/
|
||||
|
||||
#include "nssilock.h"
|
||||
@ -991,6 +991,10 @@ CERT_CheckCertValidTimes(CERTCertificate *c, PRTime t, PRBool allowOverride)
|
||||
PRTime notBefore, notAfter, llPendingSlop, tmp1;
|
||||
SECStatus rv;
|
||||
|
||||
if (!c) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
return(secCertTimeUndetermined);
|
||||
}
|
||||
/* if cert is already marked OK, then don't bother to check */
|
||||
if ( allowOverride && c->timeOK ) {
|
||||
return(secCertTimeValid);
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
/*
|
||||
* certt.h - public data structures for the certificate library
|
||||
*
|
||||
* $Id: certt.h,v 1.27 2004-04-25 15:03:03 gerv%gerv.net Exp $
|
||||
* $Id: certt.h,v 1.28 2004-05-11 02:43:09 jpierre%netscape.com Exp $
|
||||
*/
|
||||
#ifndef _CERTT_H_
|
||||
#define _CERTT_H_
|
||||
@ -517,7 +517,9 @@ typedef enum CERTCertOwnerEnum {
|
||||
typedef enum SECCertTimeValidityEnum {
|
||||
secCertTimeValid = 0,
|
||||
secCertTimeExpired = 1,
|
||||
secCertTimeNotValidYet = 2
|
||||
secCertTimeNotValidYet = 2,
|
||||
secCertTimeUndetermined = 3 /* validity could not be decoded from the
|
||||
cert, most likely because it was NULL */
|
||||
} SECCertTimeValidity;
|
||||
|
||||
/*
|
||||
|
||||
@ -1833,7 +1833,7 @@ CERT_GetCertNicknameWithValidity(PRArenaPool *arena, CERTCertificate *cert,
|
||||
char *expiredString, char *notYetGoodString)
|
||||
{
|
||||
SECCertTimeValidity validity;
|
||||
char *nickname, *tmpstr;
|
||||
char *nickname = NULL, *tmpstr = NULL;
|
||||
|
||||
validity = CERT_CheckCertValidTimes(cert, PR_Now(), PR_FALSE);
|
||||
|
||||
@ -1856,11 +1856,16 @@ CERT_GetCertNicknameWithValidity(PRArenaPool *arena, CERTCertificate *cert,
|
||||
if ( validity == secCertTimeExpired ) {
|
||||
tmpstr = PR_smprintf("%s%s", cert->nickname,
|
||||
expiredString);
|
||||
} else {
|
||||
} else if ( validity == secCertTimeNotValidYet ) {
|
||||
/* not yet valid */
|
||||
tmpstr = PR_smprintf("%s%s", cert->nickname,
|
||||
notYetGoodString);
|
||||
}
|
||||
} else {
|
||||
/* undetermined */
|
||||
tmpstr = PR_smprintf("%s",
|
||||
"(NULL) (Validity Unknown)");
|
||||
}
|
||||
|
||||
if ( tmpstr == NULL ) {
|
||||
goto loser;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user