changeset 24008:67cb8706a2f2

Fix a NULL pointer deref in the NSS SSL implementation with certain self-signed certs. Fixes #7013
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 08 Sep 2008 23:04:15 +0000
parents 8777560c1d9f
children 4ada5e2189d6
files libpurple/plugins/ssl/ssl-nss.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-nss.c	Mon Sep 08 01:29:00 2008 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Mon Sep 08 23:04:15 2008 +0000
@@ -285,7 +285,8 @@
 	}
 	
 	for (count = 0 ; count < CERT_MAX_CERT_CHAIN ; count++) {
-		purple_debug_info("nss", "subject=%s issuer=%s\n", curcert->subjectName, curcert->issuerName);
+		purple_debug_info("nss", "subject=%s issuer=%s\n", curcert->subjectName,
+						  curcert->issuerName  ? curcert->issuerName : "(null)");
 		newcrt = x509_import_from_nss(curcert);
 		peer_certs = g_list_append(peer_certs, newcrt);
 
@@ -676,7 +677,8 @@
 	subjectCert = X509_NSS_DATA(crt);
 	g_return_val_if_fail(subjectCert, FALSE);
 
-	if ( PORT_Strcmp(subjectCert->issuerName, issuerCert->subjectName) != 0 )
+	if (subjectCert->issuerName == NULL
+			|| PORT_Strcmp(subjectCert->issuerName, issuerCert->subjectName) != 0)
 		return FALSE;
 	st = CERT_VerifySignedData(&subjectCert->signatureWrap, issuerCert, PR_Now(), NULL);
 	return st == SECSuccess;