aboutsummaryrefslogtreecommitdiff
path: root/gdb/osfsolib.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1995-10-12 23:26:06 +0000
committerJeff Law <law@redhat.com>1995-10-12 23:26:06 +0000
commit148070cca4cf7e1b1b7f81835e9ec9991f1895ef (patch)
treefc5e0c036682acf0eb6bc18a0978c752fe8e5a82 /gdb/osfsolib.c
parenta8958dd48be372e5b3004c61729071c36f8717a0 (diff)
downloadgdb-148070cca4cf7e1b1b7f81835e9ec9991f1895ef.zip
gdb-148070cca4cf7e1b1b7f81835e9ec9991f1895ef.tar.gz
gdb-148070cca4cf7e1b1b7f81835e9ec9991f1895ef.tar.bz2
* corelow.c (core_open): Don't update the to_sections and
to_sections_end fields in core_ops here. It's too late. * irix5-nat.c (solib_add): Update the to_sections and to_sections_end fields in core_ops here if needed. * osfsolib.c (solib_add): Likewise. * rs6000-nat.c (xcoff_reload_core): Likewise. * solib.c (solib_add): Likewise. * somsolib.c (solib_add): Likewise.
Diffstat (limited to 'gdb/osfsolib.c')
-rw-r--r--gdb/osfsolib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/osfsolib.c b/gdb/osfsolib.c
index 86d9606..d2b5530 100644
--- a/gdb/osfsolib.c
+++ b/gdb/osfsolib.c
@@ -625,6 +625,13 @@ solib_add (arg_string, from_tty, target)
if (count)
{
+ int update_coreops;
+
+ /* We must update the to_sections field in the core_ops structure
+ here, otherwise we dereference a potential dangling pointer
+ for each call to target_read/write_memory within this routine. */
+ update_coreops = core_ops.to_sections == target->to_sections;
+
/* Reallocate the target's section table including the new size. */
if (target -> to_sections)
{
@@ -641,6 +648,14 @@ solib_add (arg_string, from_tty, target)
}
target -> to_sections_end = target -> to_sections + (count + old);
+ /* Update the to_sections field in the core_ops structure
+ if needed. */
+ if (update_coreops)
+ {
+ core_ops.to_sections = target->to_sections;
+ core_ops.to_sections_end = target->to_sections_end;
+ }
+
/* Add these section table entries to the target's table. */
while ((so = find_solib (so)) != NULL)
{