diff options
author | Jase Thew <bazerka@irssi.org> | 2010-05-16 17:50:31 +0000 |
---|---|---|
committer | bazerka <bazerka@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2010-05-16 17:50:31 +0000 |
commit | ec83dd762ada05170a9c80c6582c4754c66f9f0d (patch) | |
tree | f1b92a1be4cad59802444d7108b85bab89ba5ba9 /src/core/network-openssl.c | |
parent | daf6adc0b098fdae473e8276cab88ebec6a3ae09 (diff) | |
download | irssi-ec83dd762ada05170a9c80c6582c4754c66f9f0d.zip |
Fix segfault generated by SSL disconnections. (Bug #752)
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5170 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/network-openssl.c')
-rw-r--r-- | src/core/network-openssl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index 2c711c78..3191a1bd 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -247,6 +247,7 @@ static GIOStatus irssi_ssl_read(GIOChannel *handle, gchar *buf, gsize len, gsize GIOSSLChannel *chan = (GIOSSLChannel *)handle; gint ret1, err; const char *errstr; + gchar *errmsg; ret1 = SSL_read(chan->ssl, buf, len); if(ret1 <= 0) @@ -271,9 +272,10 @@ static GIOStatus irssi_ssl_read(GIOChannel *handle, gchar *buf, gsize len, gsize if (errstr == NULL) errstr = "unknown SSL error"; } - g_warning("SSL read error: %s", errstr); + errmsg = g_strdup_printf("SSL read error: %s", errstr); *gerr = g_error_new_literal(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, - errstr); + errmsg); + g_free(errmsg); return G_IO_STATUS_ERROR; } else @@ -290,6 +292,7 @@ static GIOStatus irssi_ssl_write(GIOChannel *handle, const gchar *buf, gsize len GIOSSLChannel *chan = (GIOSSLChannel *)handle; gint ret1, err; const char *errstr; + gchar *errmsg; ret1 = SSL_write(chan->ssl, (const char *)buf, len); if(ret1 <= 0) @@ -314,9 +317,10 @@ static GIOStatus irssi_ssl_write(GIOChannel *handle, const gchar *buf, gsize len if (errstr == NULL) errstr = "unknown SSL error"; } - g_warning("SSL write error: %s", errstr); + errmsg = g_strdup_printf("SSL write error: %s", errstr); *gerr = g_error_new_literal(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, - errstr); + errmsg); + g_free(errmsg); return G_IO_STATUS_ERROR; } else |