[RFC PATCH] realloc: Make REALLOC_ZERO_BYTES_FREES into a tunable
Paul Eggert
eggert@cs.ucla.edu
Fri Oct 25 23:30:09 GMT 2024
On 2024-10-25 15:58, Alejandro Colomar wrote:
> The purpose of the change was
> to prevent vulnerabilities, not to promote the use of null pointers as
> 0-sized objects.
Not sure I agree about the purpose. Lots of GNU code has used null
pointers as zero-sized objects for years. It's a natural consequence of
starting off a (pointer,size) pair as both zero, and it's been
documented as a Gnulib assumption since 2003 (code assumed it even
before that).
If compilers start warning about this sort of thing we'll shut off the
warnings. It wouldn't be the first time compilers chattered
counterproductively.
More information about the Libc-alpha
mailing list