changeset 19493:e147c3a821dd

- Errorchecking in x509_cert_dn
author William Ehlhardt <williamehlhardt@gmail.com>
date Mon, 20 Aug 2007 03:15:30 +0000
parents 447470c8111a
children 280c6ec32ca6
files libpurple/plugins/ssl/ssl-gnutls.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Mon Aug 20 03:10:21 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Mon Aug 20 03:15:30 2007 +0000
@@ -766,8 +766,6 @@
 
 	cert_dat = X509_GET_GNUTLS_DATA(crt);
 
-	/* TODO: Note return values? */
-		
 	/* Figure out the length of the Distinguished Name */
 	/* Claim that the buffer is size 0 so GnuTLS just tells us how much
 	   space it needs */
@@ -776,7 +774,12 @@
 
 	/* Now allocate and get the Distinguished Name */
 	dn = g_new0(gchar, dn_size);
-	gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size);
+	if (0 != gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size)) {
+		purple_debug_error("gnutls/x509",
+				   "Failed to get Distinguished Name\n");
+		g_free(dn);
+		return NULL;
+	}
 	
 	return dn;
 }