public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld/PDB: fix off-by-1 in add_globals_ref()
@ 2023-07-07 13:47 Jan Beulich
  2023-07-10 23:30 ` Mark Harmstone
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2023-07-07 13:47 UTC (permalink / raw)
  To: Binutils; +Cc: Mark Harmstone, Nick Clifton

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ld/PDB: fix off-by-1 in add_globals_ref()
  2023-07-07 13:47 [PATCH] ld/PDB: fix off-by-1 in add_globals_ref() Jan Beulich
@ 2023-07-10 23:30 ` Mark Harmstone
  2023-07-12  7:55   ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Harmstone @ 2023-07-10 23:30 UTC (permalink / raw)
  To: Jan Beulich, Binutils; +Cc: Nick Clifton

Thanks Jan - this looks good to me.

Mark

On 7/7/23 14:47, Jan Beulich wrote:
> 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++;
>   



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ld/PDB: fix off-by-1 in add_globals_ref()
  2023-07-10 23:30 ` Mark Harmstone
@ 2023-07-12  7:55   ` Jan Beulich
  2023-07-17 12:26     ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2023-07-12  7:55 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Mark Harmstone, Binutils

On 11.07.2023 01:30, Mark Harmstone wrote:
> Thanks Jan - this looks good to me.

I've committed this yesterday, so Nick - what about cherry-picking it onto
the branch?

Jan

> On 7/7/23 14:47, Jan Beulich wrote:
>> 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++;
>>   
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ld/PDB: fix off-by-1 in add_globals_ref()
  2023-07-12  7:55   ` Jan Beulich
@ 2023-07-17 12:26     ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2023-07-17 12:26 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Mark Harmstone, Binutils

Hi Jan,

> I've committed this yesterday, so Nick - what about cherry-picking it onto
> the branch?

Done.

Cheers
   Nick

PS.  Sorry for the delay - I have been on PTO.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-17 12:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07 13:47 [PATCH] ld/PDB: fix off-by-1 in add_globals_ref() Jan Beulich
2023-07-10 23:30 ` Mark Harmstone
2023-07-12  7:55   ` Jan Beulich
2023-07-17 12:26     ` Nick Clifton

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).