From 1c7ab81449a4fb66ef9b8dae956798edf0ece84c Mon Sep 17 00:00:00 2001 From: "nelsonb%netscape.com" Date: Wed, 9 Jul 2003 04:14:23 +0000 Subject: [PATCH] Change cert_GetCertificateEmailAddresses to return NULL rather than a pointer to an empty string when a cert has no email addresses. Partial fix for bug 211540. Modified certdb/alg1485.c git-svn-id: svn://10.0.0.236/trunk@144625 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/lib/certdb/alg1485.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mozilla/security/nss/lib/certdb/alg1485.c b/mozilla/security/nss/lib/certdb/alg1485.c index 5313c501ed2..d01b1a3f8ea 100644 --- a/mozilla/security/nss/lib/certdb/alg1485.c +++ b/mozilla/security/nss/lib/certdb/alg1485.c @@ -1029,11 +1029,13 @@ cert_GetCertificateEmailAddresses(CERTCertificate *cert) } /* now copy superstring to cert's arena */ finalLen = (pBuf - addrBuf) + 1; - pBuf = PORT_ArenaAlloc(cert->arena, finalLen); - if (pBuf) { - PORT_Memcpy(pBuf, addrBuf, finalLen); + pBuf = NULL; + if (finalLen > 1) { + pBuf = PORT_ArenaAlloc(cert->arena, finalLen); + if (pBuf) { + PORT_Memcpy(pBuf, addrBuf, finalLen); + } } - loser: if (tmpArena) PORT_FreeArena(tmpArena, PR_FALSE);