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;
 }
 
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;
 }
 
_______________________________________________
Pan-devel mailing list
Pan-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/pan-devel

Reply via email to