This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug malloc/24775] Please add a secure way to clear and free memory


https://sourceware.org/bugzilla/show_bug.cgi?id=24775

--- Comment #5 from Topi Miettinen <toiwoton at gmail dot com> ---
(In reply to Florian Weimer from comment #4)
> Note that you can get the block size using malloc_usable_size, so not
> knowing that at the site of the freeing call should not be an obstacle.
> 
> (Although malloc_usable_size may not have been interposed by a minimal
> malloc, but hopefully, none of those are left anymore.)

The problem with this is that the size returned may be greater than the
original size used during allocation and accessing the area beyond allocated
size makes MSan very unhappy. What could work is a way to get the original size
somehow (size_t malloc_allocated_size(void *ptr)?), then there would be no need
for one function that does both clearing and allocation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]