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)
Related show

Commit Message

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

-- 
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."

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