public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Alan Modra <amodra@gmail.com>, binutils@sourceware.org
Subject: Re: som: buffer overflow writing strings
Date: Tue, 29 Aug 2023 12:32:20 -0600	[thread overview]
Message-ID: <9fa664a4-beb1-c5bf-74f5-3c3088101412@gmail.com> (raw)
In-Reply-To: <ZOhLPCtC/vrqPkD7@squeak.grove.modra.org>



On 8/25/23 00:33, Alan Modra via Binutils wrote:
> Code in som_write_symbol_strings neglected to allow for padding, which
> can result in a buffer overflow.  It also used xrealloc, which we're
> not supposed to use in libbfd because libbfd isn't supposed to call
> exit.  Also a realloc is perhaps not a good idea when none of the
> buffer contents are needed, so replace with free, bfd_malloc.  There
> were three copies of the string handling code, so rather than fix them
> all I've extracted them to a function.  This necessitated making one
> of the fields in struct som_symbol unsigned.
> 
> 	* som.c (add_string): New function.
> 	(som_write_space_strings, som_write_symbol_strings): Use it.
> 	* som.h (som_symbol_type <stringtab_offset>): Make unsigned.
Thanks for fixing this.  Amazing how this problem slipped through as 
long as it did.  Of course SOM died ~20+ years ago, so that may explain 
how the bug has survived so long.

One could certainly argue about how useful being able to write object 
files for a dead format on a dead architecture is.  I wouldn't lose any 
sleep if SOM quietly went away.

jeff


  reply	other threads:[~2023-08-29 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25  6:33 Alan Modra
2023-08-29 18:32 ` Jeff Law [this message]
2023-08-30  1:03   ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fa664a4-beb1-c5bf-74f5-3c3088101412@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).