This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc][1/3] Remote core file generation: BFD support
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: "Ulrich Weigand" <uweigand at de dot ibm dot com>, binutils at sourceware dot org
- Date: Wed, 9 Nov 2011 16:00:30 +0000
- Subject: Re: [rfc][1/3] Remote core file generation: BFD support
- References: <201110211856.p9LIu92B012443@d06av02.portsmouth.uk.ibm.com>
On Friday 21 October 2011 19:56:09, Ulrich Weigand wrote:
> Index: bfd/elf32-arm.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-arm.c,v
> retrieving revision 1.278
> diff -u -p -r1.278 elf32-arm.c
> --- bfd/elf32-arm.c 19 Oct 2011 07:17:13 -0000 1.278
> +++ bfd/elf32-arm.c 21 Oct 2011 16:49:54 -0000
> @@ -1986,6 +1986,55 @@ elf32_arm_nabi_grok_psinfo (bfd *abfd, E
> return TRUE;
> }
>
> +static char *
> +elf32_arm_nabi_write_core_note (bfd *abfd, char *buf, int *bufsiz,
> + int note_type, ...)
> +{
> + switch (note_type)
> + {
> + default:
> + return NULL;
> +
> + case NT_PRPSINFO:
> + {
> + char data[124];
> + va_list ap;
> +
> + va_start (ap, note_type);
> + memset (data, 0, 28);
> + strncpy (data + 28, va_arg (ap, const char *), 16);
> + strncpy (data + 44, va_arg (ap, const char *), 80);
The `data' buffer should be zero initialized, to avoid
leaving garbage on the core, when the passed in fname and
psargs are less than 16 and 80 bytes long respectively.
It's true the caller does that itself today, but
your patch 2 (rightly) makes it not do so anymore.
--
Pedro Alves