Fix a segfault caused by under-allocating an array.
[deliverable/binutils-gdb.git] / gdb / m3-nat.c
index 50f7b717685ee44564cd461ec30aebd39ba4016b..0e56fb5952f2a19330169eea9fcfe7bc19bb36ed 100644 (file)
@@ -2010,14 +2010,11 @@ out:
   return length;
 }
 
-/* Return 0 on failure, number of bytes handled otherwise.  */
+/* Return 0 on failure, number of bytes handled otherwise.  TARGET is
+   ignored. */
 static int
-m3_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;        /* IGNORED */
+m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+               struct target_ops *target)
 {
   int result;
 
@@ -2139,9 +2136,7 @@ get_thread_name (gdb_thread_t one_cproc, int id)
 }
 
 int
-fetch_thread_info (task, mthreads_out)
-     mach_port_t task;
-     gdb_thread_t *mthreads_out;       /* out */
+fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out)
 {
   kern_return_t ret;
   thread_array_t th_table;
@@ -2460,11 +2455,12 @@ get_cprocs (void)
   gdb_thread_t cproc_head;
   gdb_thread_t cproc_copy;
   CORE_ADDR their_cprocs;
-  char *buf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+  char *buf;
   char *name;
   cthread_t cthread;
   CORE_ADDR symaddr;
 
+  buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
   symaddr = lookup_address_of_variable ("cproc_list");
 
   if (!symaddr)
This page took 0.023827 seconds and 4 git commands to generate.