ports/126846: [PATCH] irc/ctrlproxy segfaulting if unable to resolve hostname.

Ashish Shukla wahjava at gmail.com
Tue Aug 26 04:10:04 UTC 2008


>Number:         126846
>Category:       ports
>Synopsis:       [PATCH] irc/ctrlproxy segfaulting if unable to resolve hostname.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 26 04:10:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ashish Shukla
>Release:        FreeBSD 7.0-RELEASE-p3 amd64
>Organization:
N/A
>Environment:
System: FreeBSD chateau.d.lf 7.0-RELEASE-p3 FreeBSD 7.0-RELEASE-p3 #3: Tue Jul 15 10:16:13 IST 2008 root at chateau.d.lf:/usr/obj/usr/src/sys/ULE amd64

>Description:
ctrlproxy terminates with segmentation fault if it is not able to resolve hostname.
Following is the backtrace of the error taken with gdb.

% gdb `which ctrlproxy`
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) run
Starting program: /usr/local/bin/ctrlproxy 
[2008-08-26 09:21:26] Plugin dir does not exist, not loading plugins
[2008-08-26 09:21:26] CtrlProxy 3.0.7 (pid 9514) starting
[2008-08-26 09:21:26] Listening on :::6680 (admin)
[2008-08-26 09:21:26] Listening on 0.0.0.0:6680 (admin)
[2008-08-26 09:21:29] Client successfully authenticated (admin)
[2008-08-26 09:21:29] Connecting with oftc:6667 (oftc)
[2008-08-26 09:21:29] Unable to lookup oftc:6667 hostname nor servname provided, or not
 known (oftc)

Program received signal SIGSEGV, Segmentation fault.
freeaddrinfo (ai=0x0) at /usr/src/lib/libc/net/getaddrinfo.c:334
334                     next = ai->ai_next;
(gdb) bt
#0  freeaddrinfo (ai=0x0) at /usr/src/lib/libc/net/getaddrinfo.c:334
#1  0x000000000042aa3c in connect_current_tcp_server (s=0x802e03400)
    at lib/connection.c:470
#2  0x000000000042b6f9 in connect_server (s=0x802e03400) at lib/connection.c:817
#3  0x000000000042b9a7 in connect_network (s=0x802e03400) at lib/connection.c:886
#4  0x00000000004247e7 in process_from_pending_client (client=0x802e33d80, 
    l=0x802e6cda0) at lib/client.c:363
#5  0x0000000000424413 in on_transport_receive_line (transport=0x802e533e0, 
    l=0x802e6cda0) at lib/client.c:282
#6  0x00000000004257ff in handle_transport_receive (c=0x802e33c80, cond=G_IO_IN, 
    _transport=0x802e533e0) at lib/transport.c:58
#7  0x00000008009297f2 in g_io_unix_dispatch (source=0x802e33f00, 
    callback=0x42570c <handle_transport_receive>, user_data=0x802e533e0)
    at giounix.c:162
#8  0x00000008008e833b in g_main_dispatch (context=0x802e03090) at gmain.c:2012
#9  0x00000008008e9ac5 in IA__g_main_context_dispatch (context=0x802e03090)
    at gmain.c:2564
#10 0x00000008008ea0ef in g_main_context_iterate (context=0x802e03090, block=1, 
    dispatch=1, self=0x802e2f0c0) at gmain.c:2645
#11 0x00000008008ea8f9 in IA__g_main_loop_run (loop=0x802e1a080) at gmain.c:2853
#12 0x000000000040a6c4 in main (argc=1, argv=0x7fffffffe608) at src/main.c:383
>How-To-Repeat:
1. Start ctrlproxy in one terminal
2. Start irssi (or any other irc client), which is configured with ctrlproxy as proxy in other terminal.
3. Now in the irc client window, type '/connect abcd' (where abcd is any valid domain name which can't be resolved).
4. Now, after trying to resolve hostname 'abcd', ctrlproxy will terminate with segmentation fault.
>Fix:
diff --git ctrlproxy/Makefile ctrlproxy/Makefile
index d1e1c61..bbccfd3 100644
--- ctrlproxy/Makefile
+++ ctrlproxy/Makefile
@@ -8,6 +8,7 @@
 
 PORTNAME=	ctrlproxy
 PORTVERSION=	3.0.7
+PORTREVISION=	1
 CATEGORIES=	irc
 MASTER_SITES=	http://www.ctrlproxy.org/releases/ \
 		LOCAL/chinsan/ctrlproxy/
diff --git ctrlproxy/files/patch-lib_connection.c ctrlproxy/files/patch-lib_connection.c
new file mode 100644
index 0000000..d5df0a2
--- /dev/null
+++ ctrlproxy/files/patch-lib_connection.c
@@ -0,0 +1,15 @@
+
+$FreeBSD$
+
+--- lib/connection.c.orig
++++ lib/connection.c
+@@ -467,7 +467,8 @@
+ 	if (error) {
+ 		network_log(LOG_ERROR, s, "Unable to lookup %s:%s %s", 
+ 					cs->host, cs->port, gai_strerror(error));
+-		freeaddrinfo(addrinfo);
++		if(addrinfo)
++			freeaddrinfo(addrinfo);
+ 		return FALSE;
+ 	}
+ 

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list