From 8698edb8ae42650a5222a2209b23ad513834b5e5 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 26 Jun 2002 05:37:29 +0000 Subject: * dcrt0.cc (_dcrt0): Be more defensive when reserved block is used and it's not cygwin info. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/dcrt0.cc | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 330ef3aab..9fe94d0ea 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-06-26 Christopher Faylor + + * dcrt0.cc (_dcrt0): Be more defensive when reserved block is used and + it's not cygwin info. + 2002-06-26 Christopher Faylor * autoload (noload): Avoid clobbering bx register. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index f5fef08aa..da2865112 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -821,8 +821,10 @@ _dll_crt0 () GetStartupInfo (&si); child_proc_info = (child_info *) si.lpReserved2; - if (si.cbReserved2 >= EXEC_MAGIC_SIZE && - memcmp (child_proc_info->zero, zeros, sizeof (zeros)) == 0) + if (si.cbReserved2 < EXEC_MAGIC_SIZE || !child_proc_info + || memcmp (child_proc_info->zero, zeros, sizeof (zeros)) != 0) + child_proc_info = NULL; + else { if ((child_proc_info->intro & OPROC_MAGIC_MASK) == OPROC_MAGIC_GENERIC) multiple_cygwin_problem ("proc", child_proc_info->intro, 0); -- cgit v1.2.3