changeset 7467:f9ed27be344e

[gaim-migrate @ 8080] this should prevent SSL segfaults when you cancel connections before any SSL magic happens committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 09 Nov 2003 08:49:16 +0000
parents fa0324675ed9
children 4ab8ec97576c
files plugins/ssl/ssl-gnutls.c plugins/ssl/ssl-nss.c
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ssl/ssl-gnutls.c	Sun Nov 09 07:58:23 2003 +0000
+++ b/plugins/ssl/ssl-gnutls.c	Sun Nov 09 08:49:16 2003 +0000
@@ -110,6 +110,9 @@
 {
 	GaimSslGnutlsData *gnutls_data = GAIM_SSL_GNUTLS_DATA(gsc);
 
+	if(!gnutls_data)
+		return;
+
 	gnutls_bye(gnutls_data->session, GNUTLS_SHUT_RDWR);
 
 	gnutls_deinit(gnutls_data->session);
@@ -135,9 +138,10 @@
 ssl_gnutls_write(GaimSslConnection *gsc, const void *data, size_t len)
 {
 	GaimSslGnutlsData *gnutls_data = GAIM_SSL_GNUTLS_DATA(gsc);
-	size_t s;
+	size_t s = 0;
 
-	s = gnutls_record_send(gnutls_data->session, data, len);
+	if(gnutls_data)
+		s = gnutls_record_send(gnutls_data->session, data, len);
 
 	if (s < 0)
 		s = 0;
--- a/plugins/ssl/ssl-nss.c	Sun Nov 09 07:58:23 2003 +0000
+++ b/plugins/ssl/ssl-nss.c	Sun Nov 09 08:49:16 2003 +0000
@@ -220,6 +220,9 @@
 {
 	GaimSslNssData *nss_data = GAIM_SSL_NSS_DATA(gsc);
 
+	if(!nss_data)
+		return;
+
 	if (nss_data->in) PR_Close(nss_data->in);
 	/* if (nss_data->fd) PR_Close(nss_data->fd); */
 
@@ -239,6 +242,9 @@
 {
 	GaimSslNssData *nss_data = GAIM_SSL_NSS_DATA(gsc);
 
+	if(!nss_data)
+		return 0;
+
 	return PR_Write(nss_data->in, data, len);
 }