From cf487499e0d7ef64ab63d6c76bf298bfaf64b980 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 19 Oct 2021 16:02:49 +0100 Subject: Fix a potential illegal memory access when testing for a special LTO symbol name. bfd * linker.c (_bfd_generic_link_add_one_symbol): Test for a NULL name before checking to see if the symbol is __gnu_lto_slim. * archive.c (_bfd_compute_and_write_armap): Likewise. binutils * nm.c (filter_symbols): Test for a NULL name before checking to see if the symbol is __gnu_lto_slim. * objcopy.c (filter_symbols): Likewise. --- binutils/objcopy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'binutils/objcopy.c') diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 75fd89d..0e7400f 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1542,7 +1542,8 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms, { char *new_name; - if (name[0] == '_' + if (name != NULL + && name[0] == '_' && name[1] == '_' && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0) { -- cgit v1.1