pan-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-devel] [PATCH] fix segfault on nntp server connect failure


From: Cal Peake
Subject: [Pan-devel] [PATCH] fix segfault on nntp server connect failure
Date: Fri, 1 Feb 2013 10:59:17 -0500 (EST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

Hi,

Attached (and below) is a cut-n-paste job from 
pan/tasks/socket-impl-openssl.cc to pan/tasks/socket-impl-gio.cc that 
fixes a segfault that occurs if we're unable to establish a connection to 
a configured news server.

Technical details: A failure to connect in the function create_channel() 
leaves a GIOChannel pointer uninitialized that then gets passed to 
g_io_channel_{unix,win32}_get_fd().

Kind regards,

-- 
Cal Peake

diff --git a/pan/tasks/socket-impl-gio.cc b/pan/tasks/socket-impl-gio.cc
index b11e926..afeb1a3 100644
--- a/pan/tasks/socket-impl-gio.cc
+++ b/pan/tasks/socket-impl-gio.cc
@@ -286,11 +286,14 @@ GIOChannelSocket :: open (const StringView& address, int 
port, std::string& setm
 {
   _host.assign (address.str, address.len);
   _channel = create_channel (address, port, setme_err);
+  if (_channel)
+  {
 #ifdef G_OS_WIN32
   _id = g_io_channel_win32_get_fd(_channel);
 #else
    _id = g_io_channel_unix_get_fd(_channel);
 #endif // G_OS_WIN32
+  }
   return _channel != 0;
 }
 

Attachment: fix-gio-socket-segfault.diff
Description: patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]