public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] ld/PDB: fix off-by-1 in add_globals_ref()
@ 2023-07-11  6:16 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-07-11  6:16 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb70d820e85d1a10c3838088c4b551eef01efa61

commit eb70d820e85d1a10c3838088c4b551eef01efa61
Author: Jan Beulich <jbeulich@suse.com>
Date:   Tue Jul 11 08:14:57 2023 +0200

    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:
---
 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++;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-11  6:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11  6:16 [binutils-gdb] ld/PDB: fix off-by-1 in add_globals_ref() Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).