Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-09-05 05:55:01 +0400
committerChristopher Faylor <me@cgf.cx>2003-09-05 05:55:01 +0400
commitc6f53ff6bedce72a721f71645cd32d2805ba1a3b (patch)
tree1820cd0e33f4a545a1bf3630b2fe3b898ce76cff /winsup/cygwin
parentcf88c20fd99ca043af3063f2803864c1dd416dd6 (diff)
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog13
-rw-r--r--winsup/cygwin/cygheap.h2
-rw-r--r--winsup/cygwin/dcrt0.cc3
-rw-r--r--winsup/cygwin/fhandler_console.cc4
-rw-r--r--winsup/cygwin/fhandler_raw.cc2
-rw-r--r--winsup/cygwin/pinfo.cc17
6 files changed, 32 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d2dd326b9..f85060831 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* sysconf.cc (sysconf): Return more accurate value for _SC_AVPHYS_PAGES.
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index 7a637fa04..499e7d37e 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -259,7 +259,7 @@ struct init_cygheap
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 void *cygheap_max;
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index b4f7bdf5e..635759bb8 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -523,6 +523,7 @@ alloc_stack (child_info_fork *ci)
}
static NO_COPY int mypid = 0;
+int __argc_safe;
int _declspec(dllexport) __argc;
char _declspec(dllexport) **__argv;
vfork_save NO_COPY *main_vfork = NULL;
@@ -606,7 +607,7 @@ dll_crt0_1 ()
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
h = NULL;
set_myself (mypid, h);
- __argc = spawn_info->moreinfo->argc;
+ __argc = __argc_safe = spawn_info->moreinfo->argc;
__argv = spawn_info->moreinfo->argv;
envp = spawn_info->moreinfo->envp;
envc = spawn_info->moreinfo->envc;
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 0d7015246..27f85db1b 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -507,12 +507,12 @@ fhandler_console::read (void *pv, size_t& buflen)
err:
__seterrno ();
- (ssize_t) buflen = -1;
+ buflen = (size_t) -1;
return;
sig_exit:
set_sig_errno (EINTR);
- (ssize_t) buflen = -1;
+ buflen = (size_t) -1;
return;
}
diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc
index 42f84073d..5fdf462ab 100644
--- a/winsup/cygwin/fhandler_raw.cc
+++ b/winsup/cygwin/fhandler_raw.cc
@@ -333,7 +333,7 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
return;
err:
- (ssize_t) ulen = -1;
+ ulen = (size_t) -1;
return;
}
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 2e254303e..3d11b24d5 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -289,18 +289,27 @@ _pinfo::commune_recv ()
{
unsigned n = 1;
CloseHandle (__fromthem); __fromthem = NULL;
- for (char **a = __argv; *a; a++)
- n += strlen (*a) + 1;
+ extern int __argc_safe;
+ 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))
{
/*__seterrno ();*/ // this is run from the signal thread, so don't set errno
sigproc_printf ("WriteFile sizeof argv failed, %E");
}
else
- for (char **a = __argv; *a; a++)
+ for (const char **a = argv; *a; a++)
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;
}
if (!WriteFile (__tothem, "", 1, &nr, NULL))