[commit] dwarf2read.c (typename_concat): avoid segv
Daniel Jacobowitz
drow@false.org
Fri Oct 24 18:43:00 GMT 2008
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
More information about the Gdb-patches
mailing list