* dcrt0.cc (__argc_safe): New variable.
(dll_crt0_1): Store argc in __argc_safe, which will theoretically remain untouched by the user. * fhandler_console.cc (fhandler_console::read): Silence some compiler warnings. * fhandler_raw.cc (fhandler_dev_raw::raw_read): Ditto. * pinfo.cc (_pinfo::commune_recv): Carefully bound argv scan and check for potentially bad pointers since user could have set argv cell to anythinw. * cygheap.h (CYGHEAPSIZE): Bump up size.
This commit is contained in:
parent
cf88c20fd9
commit
c6f53ff6be
@ -1,3 +1,16 @@
|
|||||||
|
2003-09-04 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* dcrt0.cc (__argc_safe): New variable.
|
||||||
|
(dll_crt0_1): Store argc in __argc_safe, which will theoretically
|
||||||
|
remain untouched by the user.
|
||||||
|
* fhandler_console.cc (fhandler_console::read): Silence some compiler
|
||||||
|
warnings.
|
||||||
|
* fhandler_raw.cc (fhandler_dev_raw::raw_read): Ditto.
|
||||||
|
* pinfo.cc (_pinfo::commune_recv): Carefully bound argv scan and check
|
||||||
|
for potentially bad pointers since user could have set argv cell to
|
||||||
|
anythinw.
|
||||||
|
* cygheap.h (CYGHEAPSIZE): Bump up size.
|
||||||
|
|
||||||
2003-09-04 Corinna Vinschen <corinna@vinschen.de>
|
2003-09-04 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* sysconf.cc (sysconf): Return more accurate value for _SC_AVPHYS_PAGES.
|
* sysconf.cc (sysconf): Return more accurate value for _SC_AVPHYS_PAGES.
|
||||||
|
@ -259,7 +259,7 @@ struct init_cygheap
|
|||||||
struct sigaction *sigs;
|
struct sigaction *sigs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CYGHEAPSIZE (sizeof (init_cygheap) + (16000 * sizeof (fhandler_union)) + (5 * 65536))
|
#define CYGHEAPSIZE (sizeof (init_cygheap) + (20000 * sizeof (fhandler_union)) + (5 * 65536))
|
||||||
|
|
||||||
extern init_cygheap *cygheap;
|
extern init_cygheap *cygheap;
|
||||||
extern void *cygheap_max;
|
extern void *cygheap_max;
|
||||||
|
@ -523,6 +523,7 @@ alloc_stack (child_info_fork *ci)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static NO_COPY int mypid = 0;
|
static NO_COPY int mypid = 0;
|
||||||
|
int __argc_safe;
|
||||||
int _declspec(dllexport) __argc;
|
int _declspec(dllexport) __argc;
|
||||||
char _declspec(dllexport) **__argv;
|
char _declspec(dllexport) **__argv;
|
||||||
vfork_save NO_COPY *main_vfork = NULL;
|
vfork_save NO_COPY *main_vfork = NULL;
|
||||||
@ -606,7 +607,7 @@ dll_crt0_1 ()
|
|||||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
||||||
h = NULL;
|
h = NULL;
|
||||||
set_myself (mypid, h);
|
set_myself (mypid, h);
|
||||||
__argc = spawn_info->moreinfo->argc;
|
__argc = __argc_safe = spawn_info->moreinfo->argc;
|
||||||
__argv = spawn_info->moreinfo->argv;
|
__argv = spawn_info->moreinfo->argv;
|
||||||
envp = spawn_info->moreinfo->envp;
|
envp = spawn_info->moreinfo->envp;
|
||||||
envc = spawn_info->moreinfo->envc;
|
envc = spawn_info->moreinfo->envc;
|
||||||
|
@ -507,12 +507,12 @@ fhandler_console::read (void *pv, size_t& buflen)
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
(ssize_t) buflen = -1;
|
buflen = (size_t) -1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sig_exit:
|
sig_exit:
|
||||||
set_sig_errno (EINTR);
|
set_sig_errno (EINTR);
|
||||||
(ssize_t) buflen = -1;
|
buflen = (size_t) -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
(ssize_t) ulen = -1;
|
ulen = (size_t) -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,18 +289,27 @@ _pinfo::commune_recv ()
|
|||||||
{
|
{
|
||||||
unsigned n = 1;
|
unsigned n = 1;
|
||||||
CloseHandle (__fromthem); __fromthem = NULL;
|
CloseHandle (__fromthem); __fromthem = NULL;
|
||||||
for (char **a = __argv; *a; a++)
|
extern int __argc_safe;
|
||||||
n += strlen (*a) + 1;
|
const char *argv[__argc_safe + 1];
|
||||||
|
for (int i = 0; i < __argc_safe; i++)
|
||||||
|
{
|
||||||
|
if (IsBadStringPtr (__argv[i], 0x7fffffff))
|
||||||
|
argv[i] = "";
|
||||||
|
else
|
||||||
|
argv[i] = __argv[i];
|
||||||
|
n += strlen (argv[i]) + 1;
|
||||||
|
}
|
||||||
|
argv[__argc_safe] = NULL;
|
||||||
if (!WriteFile (__tothem, &n, sizeof n, &nr, NULL))
|
if (!WriteFile (__tothem, &n, sizeof n, &nr, NULL))
|
||||||
{
|
{
|
||||||
/*__seterrno ();*/ // this is run from the signal thread, so don't set errno
|
/*__seterrno ();*/ // this is run from the signal thread, so don't set errno
|
||||||
sigproc_printf ("WriteFile sizeof argv failed, %E");
|
sigproc_printf ("WriteFile sizeof argv failed, %E");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (char **a = __argv; *a; a++)
|
for (const char **a = argv; *a; a++)
|
||||||
if (!WriteFile (__tothem, *a, strlen (*a) + 1, &nr, NULL))
|
if (!WriteFile (__tothem, *a, strlen (*a) + 1, &nr, NULL))
|
||||||
{
|
{
|
||||||
sigproc_printf ("WriteFile arg %d failed, %E", a - __argv);
|
sigproc_printf ("WriteFile arg %d failed, %E", a - argv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!WriteFile (__tothem, "", 1, &nr, NULL))
|
if (!WriteFile (__tothem, "", 1, &nr, NULL))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user