alloc-util: introduce MALLOC_SIZEOF_SAFE() helper
authorLennart Poettering <lennart@poettering.net>
Tue, 18 May 2021 20:27:24 +0000 (22:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 19 May 2021 14:42:00 +0000 (16:42 +0200)
commit6df28e1f847d68ad37ffe3f4ff47745b55233861
tree2366ae0c63be949c236045e5f79b505021b8d0b5
parent871a3a33bbb3458c97e47fc828243082014fc583
alloc-util: introduce MALLOC_SIZEOF_SAFE() helper

It's a wrapper around malloc_usable_size() that is supposed to be
compatible with _FORTIFY_SOURCES=1, by taking the
__builtin_object_size() data into account, the same way as the
_FORTIFY_SOURCES=1 logic does.

Fixes: #19203
src/basic/alloc-util.h
src/basic/fileio.c
src/basic/memory-util.h
src/basic/string-util.c