From: Daniel Jacobowitz <drow@false.org>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [commit] dwarf2read.c (typename_concat): avoid segv
Date: Fri, 24 Oct 2008 18:43:00 -0000 [thread overview]
Message-ID: <20081024184301.GA7759@caradoc.them.org> (raw)
In-Reply-To: <20081024182614.58B191C7947@localhost>
On Fri, Oct 24, 2008 at 11:26:14AM -0700, Doug Evans wrote:
> Hi. I checked in the following as obvious.
> Running a large app with many shared libs under gdb -r caused gdb to segv.
Shouldn't this be in the affected caller? I thought we wouldn't reach
here if prefix or suffix are NULL.
> if (obs == NULL)
> {
> char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
> - retval[0] = '\0';
> -
> - if (prefix)
> - {
> - strcpy (retval, prefix);
> - strcat (retval, sep);
> - }
> - if (suffix)
> - strcat (retval, suffix);
> -
> + strcpy (retval, prefix);
> + strcat (retval, sep);
> + strcat (retval, suffix);
> return retval;
> }
> else
If NULL values are valid, this change is definitely not correct.
You've changed a NULL prefix and "foo" suffix from "foo" to "::foo".
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-10-24 18:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 18:26 Doug Evans
2008-10-24 18:43 ` Daniel Jacobowitz [this message]
2008-10-24 18:48 ` Daniel Jacobowitz
2008-10-24 18:57 ` Doug Evans
2008-10-24 19:01 ` Daniel Jacobowitz
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=20081024184301.GA7759@caradoc.them.org \
--to=drow@false.org \
--cc=dje@google.com \
--cc=gdb-patches@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