diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3e893bd74..65dd26787 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2006-03-19 Christopher Faylor + + * pinfo.cc (commune_process): Fix randomly invalid pointer which caused + fifos to work incorrectly. + 2006-03-19 Christopher Faylor * dcrt0.cc (dll_crt0_0): Oops. We need to bother with setting this in diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index cacfc7913..cc64e2f81 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -402,6 +402,8 @@ commune_process (void *arg) ProtectHandle (process_sync); lock_process now (false); + if (si._si_commune._si_code & PICOM_EXTRASTR) + si._si_commune._si_str = (char *) (&si + 1); switch (si._si_commune._si_code) { @@ -524,7 +526,7 @@ commune_process (void *arg) } case PICOM_FIFO: { - sigproc_printf ("processing PICOM_FIFO"); + sigproc_printf ("processing PICOM_FIFO for %s", si._si_commune._si_str); fhandler_fifo *fh = cygheap->fdtab.find_fifo (si._si_commune._si_str); HANDLE it[2]; if (fh == NULL) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index a82e90002..55fbb636d 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -679,10 +679,14 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) else { size_t n = strlen (si._si_commune._si_str); - char *p = leader = (char *) alloca (sizeof (pack) + sizeof (n) + n); - memcpy (p, &pack, sizeof (pack)); p += sizeof (pack); - memcpy (p, &n, sizeof (n)); p += sizeof (n); - memcpy (p, si._si_commune._si_str, n); p += n; + char *p = leader = (char *) alloca (sizeof (pack) + sizeof (n) + n /*DELETEME*/ + 1); + memcpy (p, &pack, sizeof (pack)); + p += sizeof (pack); + memcpy (p, &n, sizeof (n)); + p += sizeof (n); + memcpy (p, si._si_commune._si_str, n); +p[n] = '\0'; sigproc_printf ("n %d, si_str %s", n, p); + p += n; packsize = p - leader; }