From eb70d820e85d1a10c3838088c4b551eef01efa61 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 11 Jul 2023 08:14:57 +0200 Subject: [PATCH] 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. --- ld/pdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++; -- 2.30.2