diff mbox series

rtld: copy terminating null in tunables_strdup (bug 28256)

Message ID 87tujgsgg6.fsf@igel.home
State New
Headers show
Series rtld: copy terminating null in tunables_strdup (bug 28256) | expand

Commit Message

Andreas Schwab Aug. 23, 2021, 8:39 a.m. UTC
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(-)

Comments

Siddhesh Poyarekar Aug. 23, 2021, 9:40 a.m. UTC | #1
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];
>   
>
diff mbox series

Patch

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