[PATCH] calloc: handle wrap around in total buffer size correctly

Sascha Hauer s.hauer at pengutronix.de
Tue Jul 30 01:14:26 PDT 2024


On Wed, 24 Jul 2024 11:47:45 +0200, Ahmad Fatoum wrote:
> calloc() should allocate a memory buffer that fits the product of its
> arguments or return NULL if this is not possible.
> 
> We violated this so far and a wraparound would result in allocating a
> too small buffer leading to buffer overflows.
> 
> Fix this by using size_mull which saturates at SIZE_MAX, which malloc
> should gracefully return NULL for.
> 
> [...]

Applied, thanks!

[1/1] calloc: handle wrap around in total buffer size correctly
      https://git.pengutronix.de/cgit/barebox/commit/?id=198054e168f8 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer at pengutronix.de>




More information about the barebox mailing list