rtld: copy terminating null in tunables_strdup (bug 28256)
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
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
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];
>
>
@@ -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];