The socket code in wxWidgets doesn't initialize the servent_data
structure that is passed to getservbyname_r().  Programs that use this
code die with a segfault.  The attached patch zero-fills the buffer with
memset().  I've sent a bug report to the upstream maintainers (ticket
#10332).

? wxWidgets-2.8.7-port.diff
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/wxWidgets/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile	11 Nov 2008 17:19:34 -0000	1.13
+++ Makefile	5 Jan 2009 17:26:24 -0000
@@ -5,7 +5,7 @@
 COMMENT=	c++ cross-platform GUI toolkit
 
 DISTNAME=	wxWidgets-2.8.7
-PKGNAME=	wxWidgets-gtk2-2.8.7p0
+PKGNAME=	wxWidgets-gtk2-2.8.7p1
 SHARED_LIBS=	wx_base			1.0	\
 		wx_base_net		1.0	\
 		wx_base_odbc		1.0	\
Index: patches/patch-src_unix_gsocket_cpp
===================================================================
RCS file: patches/patch-src_unix_gsocket_cpp
diff -N patches/patch-src_unix_gsocket_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_unix_gsocket_cpp	5 Jan 2009 17:26:24 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+--- src/unix/gsocket.cpp.orig	Wed Nov 21 13:43:17 2007
++++ src/unix/gsocket.cpp	Mon Jan  5 16:26:31 2009
+@@ -2116,6 +2116,7 @@ GSocketError GAddress_INET_SetPortName(GAddress *addre
+   char buffer[1024];
+ #endif
+   struct servent serv;
++  memset(&buffer, 0, sizeof(buffer));
+   se = wxGetservbyname_r(port, protocol, &serv,
+ 			 (void*)&buffer, sizeof(buffer));
+   if (!se)

Reply via email to