summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwchang0222%aol.com <devnull@localhost>2003-12-03 00:09:05 +0000
committerwchang0222%aol.com <devnull@localhost>2003-12-03 00:09:05 +0000
commit5463fd04cefe3c161af001c2eb0346b49ff6660b (patch)
treeab3b607d0db8bc1979466938fec52238e68623b8
parentc4953cdedb1b678ee1cf8b1c300165cefe85f1b0 (diff)
downloadnss-hg-5463fd04cefe3c161af001c2eb0346b49ff6660b.tar.gz
Bugscape bug 54021: in CERT_FindSubjectKeyIDExtension, if PORT_NewArena
fails we should return SECFailure. Document that the return values of CERT_GetCommonName and NSS_CMSSignerInfo_GetSignerCommonName must be freed with PORT_Free. r=nelsonb. Modified Files: certdb/alg1485.c certdb/cert.h certdb/certv3.c smime/cms.h smime/cmssiginfo.c
-rw-r--r--security/nss/lib/certdb/alg1485.c1
-rw-r--r--security/nss/lib/certdb/cert.h1
-rw-r--r--security/nss/lib/certdb/certv3.c2
-rw-r--r--security/nss/lib/smime/cms.h2
-rw-r--r--security/nss/lib/smime/cmssiginfo.c2
5 files changed, 6 insertions, 2 deletions
diff --git a/security/nss/lib/certdb/alg1485.c b/security/nss/lib/certdb/alg1485.c
index f1a450f47..916f09cbe 100644
--- a/security/nss/lib/certdb/alg1485.c
+++ b/security/nss/lib/certdb/alg1485.c
@@ -1102,6 +1102,7 @@ CERT_GetCertEmailAddress(CERTName *name)
return(emailAddr);
}
+/* The return value must be freed with PORT_Free. */
char *
CERT_GetCommonName(CERTName *name)
{
diff --git a/security/nss/lib/certdb/cert.h b/security/nss/lib/certdb/cert.h
index 34f0339cb..a154cba78 100644
--- a/security/nss/lib/certdb/cert.h
+++ b/security/nss/lib/certdb/cert.h
@@ -733,6 +733,7 @@ extern const char * CERT_GetFirstEmailAddress(CERTCertificate * cert);
extern const char * CERT_GetNextEmailAddress(CERTCertificate * cert,
const char * prev);
+/* The return value must be freed with PORT_Free. */
extern char *CERT_GetCommonName(CERTName *name);
extern char *CERT_GetCountryName(CERTName *name);
diff --git a/security/nss/lib/certdb/certv3.c b/security/nss/lib/certdb/certv3.c
index 7952a0534..f4e11b3ae 100644
--- a/security/nss/lib/certdb/certv3.c
+++ b/security/nss/lib/certdb/certv3.c
@@ -310,6 +310,8 @@ CERT_FindSubjectKeyIDExtension(CERTCertificate *cert, SECItem *retItem)
rv = SECITEM_CopyItem(NULL, retItem, &decodedValue);
}
PORT_FreeArena(tmpArena, PR_FALSE);
+ } else {
+ rv = SECFailure;
}
}
SECITEM_FreeItem(&encodedValue, PR_FALSE);
diff --git a/security/nss/lib/smime/cms.h b/security/nss/lib/smime/cms.h
index 16d4f30e9..7003a6e27 100644
--- a/security/nss/lib/smime/cms.h
+++ b/security/nss/lib/smime/cms.h
@@ -670,7 +670,7 @@ NSS_CMSSignerInfo_GetSigningCertificate(NSSCMSSignerInfo *signerinfo, CERTCertDB
*
* sinfo - signerInfo data for this signer
*
- * Returns a pointer to allocated memory, which must be freed.
+ * Returns a pointer to allocated memory, which must be freed with PORT_Free.
* A return value of NULL is an error.
*/
extern char *
diff --git a/security/nss/lib/smime/cmssiginfo.c b/security/nss/lib/smime/cmssiginfo.c
index 89b942222..f2c13d348 100644
--- a/security/nss/lib/smime/cmssiginfo.c
+++ b/security/nss/lib/smime/cmssiginfo.c
@@ -620,7 +620,7 @@ NSS_CMSSignerInfo_GetSigningCertificate(NSSCMSSignerInfo *signerinfo, CERTCertDB
*
* sinfo - signerInfo data for this signer
*
- * Returns a pointer to allocated memory, which must be freed.
+ * Returns a pointer to allocated memory, which must be freed with PORT_Free.
* A return value of NULL is an error.
*/
char *