From: Jan Beulich Date: Tue, 11 Jul 2023 06:14:57 +0000 (+0200) Subject: ld/PDB: fix off-by-1 in add_globals_ref() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb70d820e85d1a10c3838088c4b551eef01efa61;p=binutils-gdb.git ld/PDB: fix off-by-1 in add_globals_ref() Copying one too many bytes can corrupt memory, detected/reported by glibc on a 32-bit distro. --- diff --git a/ld/pdb.c b/ld/pdb.c index 5e85f999c6b..267da50c4a7 100644 --- a/ld/pdb.c +++ b/ld/pdb.c @@ -880,7 +880,7 @@ add_globals_ref (struct globals *glob, bfd *sym_rec_stream, const char *name, g->offset = bfd_tell (sym_rec_stream); g->hash = hash; g->refcount = 1; - memcpy (g->data, data, len + 1); + memcpy (g->data, data, len); glob->num_entries++;