diff --git a/CHANGES b/CHANGES index c3cabd2..9ed9651 100644 --- a/CHANGES +++ b/CHANGES @@ -44,6 +44,11 @@ corrections: only expected broken messages, not corrupted stack (glibc 2.11.1, Ubuntu 10.4) + an internal store for child pids was susceptible to pid reuse which + could lead to sporadic data loss when both fork option and exec address + were used. Thanks to Tetsuya Sodo for reporting this problem and + sending a patch + ####################### V 1.7.1.3: security: diff --git a/xio.h b/xio.h index 2110896..6bd6b66 100644 --- a/xio.h +++ b/xio.h @@ -1,5 +1,5 @@ /* source: xio.h */ -/* Copyright Gerhard Rieger 2001-2009 */ +/* Copyright Gerhard Rieger 2001-2011 */ /* Published under the GNU General Public License V.2, see file COPYING */ #ifndef __xio_h_included @@ -402,10 +402,12 @@ extern int xioopenhelp(FILE *of, int level); /* must be outside function for use by childdied handler */ extern xiofile_t *sock1, *sock2; -extern pid_t diedunknown1; /* child died before it is registered */ -extern pid_t diedunknown2; -extern pid_t diedunknown3; -extern pid_t diedunknown4; +#define NUMUNKNOWN 4 +extern pid_t diedunknown[NUMUNKNOWN]; /* child died before it is registered */ +#define diedunknown1 (diedunknown[0]) +#define diedunknown2 (diedunknown[1]) +#define diedunknown3 (diedunknown[2]) +#define diedunknown4 (diedunknown[3]) extern int xiosetsigchild(xiofile_t *xfd, int (*callback)(struct single *)); extern int xiosetchilddied(void); diff --git a/xioinitialize.c b/xioinitialize.c index 15d7d64..43bd875 100644 --- a/xioinitialize.c +++ b/xioinitialize.c @@ -1,5 +1,5 @@ /* source: xioinitialize.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2011 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for the initialize function */ @@ -172,7 +172,11 @@ static int xio_nokill(xiofile_t *sock) { returns 0 on success or != 0 if an error occurred */ int xio_forked_inchild(void) { int result = 0; + int i; + for (i=0; i