diff options
author | Michael Snyder <msnyder@vmware.com> | 2002-01-08 00:59:31 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2002-01-08 00:59:31 +0000 |
commit | 94cd915f48523bbcbe20f74835d7f5a9d0b3a916 (patch) | |
tree | dc78d55a6fc5d5e7ae9a34a443711986bb9b714d /gdb/symm-nat.c | |
parent | 1dba4cb4baa4862670e9019c2bd1f718807b4b92 (diff) | |
download | gdb-94cd915f48523bbcbe20f74835d7f5a9d0b3a916.zip gdb-94cd915f48523bbcbe20f74835d7f5a9d0b3a916.tar.gz gdb-94cd915f48523bbcbe20f74835d7f5a9d0b3a916.tar.bz2 |
2002-01-07 Michael Snyder <msnyder@redhat.com>
* infptrace.c (GDB_MAX_ALLOCA): New define.
(child_xfer_memory): Use xmalloc/xfree instead of alloca if the
size of the buffer exceeds GDB_MAX_ALLOCA (default 1 megabyte,
can be overridden with whatever value is appropriate to the host).
* infttrace.c (child_xfer_memory): Add FIXME warning about use of
alloca to allocate potentially large buffer.
* rs6000-nat.c (child_xfer_memory): Ditto.
* symm-nat.c (child_xfer_memory): Ditto.
* x86-64-linux-nat.c (child_xfer_memory): Ditto.
Diffstat (limited to 'gdb/symm-nat.c')
-rw-r--r-- | gdb/symm-nat.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c index 183fa91..d686777 100644 --- a/gdb/symm-nat.c +++ b/gdb/symm-nat.c @@ -764,8 +764,11 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) / sizeof (PTRACE_XFER_TYPE); /* Allocate buffer of that many longwords. */ + /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe + because it uses alloca to allocate a buffer of arbitrary size. + For very large xfers, this could crash GDB's stack. */ register PTRACE_XFER_TYPE *buffer - = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); + = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); if (write) { |