[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZZ4Y+dak5LC6LTg7@biznet-home.integral.gnuweeb.org>
Date: Wed, 10 Jan 2024 11:11:37 +0700
From: Ammar Faizi <ammarfaizi2@...weeb.org>
To: Brennan Xavier McManus <bxmcmanus@...il.com>
Cc: Willy Tarreau <w@....eu>,
Thomas Weißschuh <linux@...ssschuh.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tools/nolibc/stdlib: fix memory error in realloc()
On Tue, Jan 09, 2024 at 06:44:02PM -0500, Brennan Xavier McManus wrote:
> Pass user_p_len to memcpy() instead of heap->len to prevent realloc()
> from copying an extra sizeof(heap) bytes from beyond the allocated
> region.
>
> Signed-off-by: Brennan Xavier McManus <bxmcmanus@...il.com>
> ---
>
> All tests from Ammar's original test program pass:
> https://gist.github.com/ammarfaizi2/db0af6aa0b95a0c7478bce64e349f021
> This fix was tested with the following added test for realloc():
> https://github.com/brennan913/nolibc-test/blob/main/nolibc_test.c#L73-L120
Hello Brennan,
Thank you for the fix!
Cc: stable@...r.kernel.org
Reviewed-by: Ammar Faizi <ammarfaizi2@...weeb.org>
Fixes: 0e0ff638400be8f497a35b51a4751fd823f6bd6a ("tools/nolibc/stdlib: Implement `malloc()`, `calloc()`, `realloc()` and `free()`")
--
Ammar Faizi
Powered by blists - more mailing lists