aboutsummaryrefslogtreecommitdiff
path: root/gdb/monitor.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1998-12-04 04:46:18 +0000
committerJason Molenda <jmolenda@apple.com>1998-12-04 04:46:18 +0000
commitedc452d07d89e2e7f5ce7e8ea77a46d3d4a8d529 (patch)
tree2547e447a6b5007bd0ba29b96bb8aa78d6a6f42f /gdb/monitor.c
parent33ccdb1b9786497b5c284c28520888166da877fa (diff)
downloadgdb-edc452d07d89e2e7f5ce7e8ea77a46d3d4a8d529.zip
gdb-edc452d07d89e2e7f5ce7e8ea77a46d3d4a8d529.tar.gz
gdb-edc452d07d89e2e7f5ce7e8ea77a46d3d4a8d529.tar.bz2
1998-12-03 Jason Molenda (jsm@bugshack.cygnus.com)
* monitor.c (monitor_read_memory): Zero out pattern buffers before calling re_search. (parse_register_dump): Ditto. PR 18049. This bug had existed erratically since I upgraded to the new gnu-regex.c this last summer. The problem is mostly in parse_register_dump; the allocated structure has some random values in it and there is a flag set in the register_pattern structure by the gnu-regex library which indicates that the values in the re_registers should be trusted. If those arbitrary contents aren't zero, gnu-regex tries to run realloc on them and we get a core dump on some hosts for some targets when the moon is just right.
Diffstat (limited to 'gdb/monitor.c')
-rw-r--r--gdb/monitor.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 60cfc14..ddd24c2 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -847,6 +847,8 @@ parse_register_dump (buf, len)
points to the start of the register value. */
struct re_registers register_strings;
+ memset (&register_strings, 0, sizeof (struct re_registers));
+
if (re_search (&register_pattern, buf, len, 0, len,
&register_strings) == -1)
break;
@@ -1759,6 +1761,7 @@ monitor_read_memory (memaddr, myaddr, len)
struct re_registers resp_strings;
RDEBUG(("MON getmem.resp_delim %s\n",current_monitor->getmem.resp_delim)) ;
+ memset (&resp_strings, 0, sizeof (struct re_registers));
tmp = strlen (p);
retval = re_search (&getmem_resp_delim_pattern, p, tmp, 0, tmp,
&resp_strings);