aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-12-17 12:41:28 +1030
committerAlan Modra <amodra@gmail.com>2021-12-17 16:01:14 +1030
commit00d44f7f2f513c56a784a6d418833bb3da8a188f (patch)
treeab23b6611ea55d54a550a6c4b65a3de10d9789dc /bfd
parent8ef22662dcd18c6b069fee3b1a10557cb2c03af4 (diff)
downloadgdb-00d44f7f2f513c56a784a6d418833bb3da8a188f.zip
gdb-00d44f7f2f513c56a784a6d418833bb3da8a188f.tar.gz
gdb-00d44f7f2f513c56a784a6d418833bb3da8a188f.tar.bz2
asan: buffer overflow in mmo_get_symbols
* mmo.c (mmo_get_symbols): Error on symbol name exceeding max length.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/mmo.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 2ee3866..d80cb06 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -1411,6 +1411,16 @@ SUBSECTION
c = c2;
}
+ if (abfd->tdata.mmo_data->symbol_position
+ >= abfd->tdata.mmo_data->max_symbol_length)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: symbol name exceeds given max length of %d"),
+ abfd, abfd->tdata.mmo_data->max_symbol_length);
+ abfd->tdata.mmo_data->have_error = true;
+ return false;
+ }
abfd->tdata.mmo_data->lop_stab_symbol[abfd->tdata.mmo_data->symbol_position++] = c;
abfd->tdata.mmo_data->lop_stab_symbol[abfd->tdata.mmo_data->symbol_position] = 0;