[PATCH] rtld: copy terminating null in tunables_strdup (bug 28256)

Siddhesh Poyarekar siddhesh@gotplt.org
Mon Aug 23 09:40:24 GMT 2021


On 8/23/21 2:09 PM, Andreas Schwab wrote:
> Avoid triggering a false positive in valgrind by copying the terminating
> null in tunables_strdup.  At this point the heap is still clean, but
> valgrind is stricter here.
> ---

Looks good to me.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

>   elf/dl-tunables.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
> index 8009e54ee5..1666736bc1 100644
> --- a/elf/dl-tunables.c
> +++ b/elf/dl-tunables.c
> @@ -56,8 +56,6 @@ tunables_strdup (const char *in)
>     if (out == (void *)-1)
>       _dl_fatal_printf ("sbrk() failure while processing tunables\n");
>   
> -  i--;
> -
>     while (i-- > 0)
>       out[i] = in[i];
>   
> 



More information about the Libc-alpha mailing list