diff --git a/CHANGES b/CHANGES index f5d53d1..17e2a78 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ corrections: + fixed possible SIGSEGV in listening addresses when a new connection was + reset by peer before the socket addresses could be retrieved. Thanks to + Mike Perry for sending a patch. + fixed a bug, introduced with version 1.7.0.0, that let client connections with option connect-timeout fail when the connections succeeded. Thanks to Bruno De Fraine for reporting this bug. diff --git a/VERSION b/VERSION index 46a401f..b433f70 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -"1.7.0.0+execshut+connecttimeout" +"1.7.0.0+execshut+connecttimeout+segvonaccept" diff --git a/xio-listen.c b/xio-listen.c index a0f4759..cb885fe 100644 --- a/xio-listen.c +++ b/xio-listen.c @@ -1,5 +1,5 @@ /* source: xio-listen.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2009 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for listen socket options */ @@ -254,8 +254,10 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl la = NULL; } Notice2("accepting connection from %s on %s", - sockaddr_info(pa?&pa->soa:NULL, pas, peername, sizeof(peername)), - sockaddr_info(pa?&la->soa:NULL, las, sockname, sizeof(sockname))); + pa? + sockaddr_info(&pa->soa, pas, peername, sizeof(peername)):"NULL", + la? + sockaddr_info(&la->soa, las, sockname, sizeof(sockname)):"NULL"); if (pa != NULL && la != NULL && xiocheckpeer(xfd, pa, la) < 0) { if (Shutdown(ps, 2) < 0) { @@ -264,9 +266,10 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl continue; } - Info1("permitting connection from %s", - sockaddr_info((struct sockaddr *)pa, pas, - infobuff, sizeof(infobuff))); + if (pa != NULL) + Info1("permitting connection from %s", + sockaddr_info((struct sockaddr *)pa, pas, + infobuff, sizeof(infobuff))); applyopts(xfd->fd, opts, PH_FD); applyopts(xfd->fd, opts, PH_CONNECTED); @@ -322,8 +325,8 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl return result; /* set the env vars describing the local and remote sockets */ - xiosetsockaddrenv("SOCK", la, las, proto); - xiosetsockaddrenv("PEER", pa, pas, proto); + if (la != NULL) xiosetsockaddrenv("SOCK", la, las, proto); + if (pa != NULL) xiosetsockaddrenv("PEER", pa, pas, proto); return 0; }