This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc][1/3] Remote core file generation: BFD support


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]