mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: Brennan Xavier McManus <bxmcmanus@gmail.com>
Cc: "Willy Tarreau" <w@1wt.eu>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tools/nolibc/stdlib: fix memory error in realloc()
Date: Wed, 10 Jan 2024 11:11:37 +0700	[thread overview]
Message-ID: <ZZ4Y+dak5LC6LTg7@biznet-home.integral.gnuweeb.org> (raw)
In-Reply-To: <ZZ3aQv3bKk30kKZA@mizu>

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@gmail.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@vger.kernel.org
Reviewed-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Fixes: 0e0ff638400be8f497a35b51a4751fd823f6bd6a ("tools/nolibc/stdlib: Implement `malloc()`, `calloc()`, `realloc()` and `free()`")

-- 
Ammar Faizi


  reply	other threads:[~2024-01-10  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 23:44 Brennan Xavier McManus
2024-01-10  4:11 ` Ammar Faizi [this message]
2024-01-10  6:17   ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZ4Y+dak5LC6LTg7@biznet-home.integral.gnuweeb.org \
    --to=ammarfaizi2@gnuweeb.org \
    --cc=bxmcmanus@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®