diff options
author | Christopher Faylor <me@cgf.cx> | 2006-03-20 01:59:23 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-03-20 01:59:23 +0000 |
commit | c5c3d69d8a5a3958515c3ee93024261bf8d9dd3d (patch) | |
tree | 872c7f2a933047411e05ce7725a540d7a11b6802 | |
parent | 7d85b417f1635c44b16571a01b43dfea6f9d3d61 (diff) | |
download | newlib-c5c3d69d8a5a3958515c3ee93024261bf8d9dd3d.zip newlib-c5c3d69d8a5a3958515c3ee93024261bf8d9dd3d.tar.gz newlib-c5c3d69d8a5a3958515c3ee93024261bf8d9dd3d.tar.bz2 |
* pinfo.cc (commune_process): Fix randomly invalid pointer which caused fifos
to work incorrectly.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/pinfo.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.cc | 12 |
3 files changed, 16 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3e893bd..65dd267 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 2006-03-19 Christopher Faylor <cgf@timesys.com> + * pinfo.cc (commune_process): Fix randomly invalid pointer which caused + fifos to work incorrectly. + +2006-03-19 Christopher Faylor <cgf@timesys.com> + * dcrt0.cc (dll_crt0_0): Oops. We need to bother with setting this in the fork/exec case. diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index cacfc79..cc64e2f 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 a82e900..55fbb63 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; } |