summaryrefslogtreecommitdiff
path: root/linuxthreads_db
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-01-30 08:20:09 +0000
committerRoland McGrath <roland@gnu.org>2003-01-30 08:20:09 +0000
commit87f728411a5d6b26aee5c55a01949cda17197499 (patch)
tree7a0a95459cd773b060d194ad7c94986a8c0f7d2a /linuxthreads_db
parenta7d9b3e09243b13d6649191d907d39eacc9dbac0 (diff)
downloadglibc-87f728411a5d6b26aee5c55a01949cda17197499.tar.gz
2003-01-29 Roland McGrath <roland@redhat.com>
* td_ta_new.c (td_ta_new): Cap the `sizeof_descr' value read from the inferior at `sizeof (struct _pthread_descr_struct)', since we use it as a length in copies to our own structures.
Diffstat (limited to 'linuxthreads_db')
-rw-r--r--linuxthreads_db/td_ta_new.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/linuxthreads_db/td_ta_new.c b/linuxthreads_db/td_ta_new.c
index 50ddf0acc3..e93d8b4c50 100644
--- a/linuxthreads_db/td_ta_new.c
+++ b/linuxthreads_db/td_ta_new.c
@@ -1,5 +1,5 @@
/* Attach to target process.
- Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -127,6 +127,9 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
{
if (ps_pdread (ps, addr, &(*ta)->sizeof_descr, sizeof (int)) != PS_OK)
goto free_return;
+ /* Don't let bogons in the inferior make us mess ourselves. */
+ if ((*ta)->sizeof_descr > sizeof (struct _pthread_descr_struct))
+ (*ta)->sizeof_descr = sizeof (struct _pthread_descr_struct);
}
/* Now add the new agent descriptor to the list. */