public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] rtld: copy terminating null in tunables_strdup (bug 28256)
@ 2021-08-23  8:39 Andreas Schwab
  2021-08-23  9:40 ` Siddhesh Poyarekar
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2021-08-23  8:39 UTC (permalink / raw)
  To: libc-alpha

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.
---
 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];
 
-- 
2.33.0


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtld: copy terminating null in tunables_strdup (bug 28256)
  2021-08-23  8:39 [PATCH] rtld: copy terminating null in tunables_strdup (bug 28256) Andreas Schwab
@ 2021-08-23  9:40 ` Siddhesh Poyarekar
  0 siblings, 0 replies; 2+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-23  9:40 UTC (permalink / raw)
  To: Andreas Schwab, libc-alpha

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];
>   
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-23  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  8:39 [PATCH] rtld: copy terminating null in tunables_strdup (bug 28256) Andreas Schwab
2021-08-23  9:40 ` Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).