[PATCH] ld/PDB: fix off-by-1 in add_globals_ref()
Jan Beulich
jbeulich@suse.com
Fri Jul 7 13:47:35 GMT 2023
Copying one too many bytes can corrupt memory, detected and reported by
glibc on a 32-bit distro.
---
Nick, again I expect this wants to go on the branch as well. I'm sorry
that I didn't get to look into this earlier; I had noticed it a while
ago already. In any event I'd like to give Mark a little bit of time
to reply (if necessary), before putting it in.
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -880,7 +880,7 @@ add_globals_ref (struct globals *glob, b
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++;
More information about the Binutils
mailing list