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
This commit is contained in:
@@ -88,7 +88,7 @@ static inline void* erase_and_free(void *p) {
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
l = malloc_usable_size(p);
|
||||
l = MALLOC_SIZEOF_SAFE(p);
|
||||
explicit_bzero_safe(p, l);
|
||||
return mfree(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user