aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-08-28 21:07:52 +0930
committerAlan Modra <amodra@gmail.com>2023-08-28 23:10:57 +0930
commitdaafebb58dac3de93ac4696dd334530b762ed67f (patch)
tree24baa1ec2258e5751a1beb2d0c26fe2664a45063 /bfd/coffcode.h
parent54d57acf610e5db2e70afa234fd4018207606774 (diff)
downloadgdb-daafebb58dac3de93ac4696dd334530b762ed67f.zip
gdb-daafebb58dac3de93ac4696dd334530b762ed67f.tar.gz
gdb-daafebb58dac3de93ac4696dd334530b762ed67f.tar.bz2
COFF swap_aux_in
A low level function like coff_swap_aux_in really has no business concatenating multiple auxents for the old PE multi-aux scheme of handling long file names. In doing so, it assumes multiple internal auxent buffers are available, which they are not in most calls to bfd_coff_swap_aux_in, both inside BFD and outside, eg. GDB. Buffer overflow fun. Concatenating multiple auxents belongs at a higher level. This required some changes to coff_get_normalized_symtab, which now uses the external auxents to access the concatenated file name. (Internal auxents are larger than the x_fname array, so the pieces of the file name are not adjacent as they are in the external auxents.) * coffswap.h (coff_swap_aux_in): Do not write more than one internal auxent. * coffcode.h (coff_bigobj_swap_aux_in): Likewise. * coffgen.c (coff_get_normalized_symtab): Normalize strings after swapping in each symbol so that external auxents are available. Use external auxents for multi-aux long file names. Formatting. Wrap long lines. Remove excess parens and unnecessary casts. Don't zalloc when only the string terminator needs zeroing, and memcpy rather than strncpy. Delete unnecessary sanity check with unsigned _n_offset. Return with failure if debug section can't be read, to avoid trying to read it multiple times. Correct sanity check against debug section size.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 908dc93..0487555 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5813,8 +5813,8 @@ coff_bigobj_swap_aux_in (bfd *abfd,
void * ext1,
int type,
int in_class,
- int indx,
- int numaux,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
void * in1)
{
AUXENT_BIGOBJ *ext = (AUXENT_BIGOBJ *) ext1;
@@ -5826,14 +5826,7 @@ coff_bigobj_swap_aux_in (bfd *abfd,
switch (in_class)
{
case C_FILE:
- if (numaux > 1)
- {
- if (indx == 0)
- memcpy (in->x_file.x_n.x_fname, ext->File.Name,
- numaux * sizeof (AUXENT_BIGOBJ));
- }
- else
- memcpy (in->x_file.x_n.x_fname, ext->File.Name, sizeof (ext->File.Name));
+ memcpy (in->x_file.x_n.x_fname, ext->File.Name, sizeof (ext->File.Name));
break;
case C_STAT: