This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug malloc/24775] Please add a secure way to clear and free memory
- From: "toiwoton at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 06 Jul 2019 08:28:44 +0000
- Subject: [Bug malloc/24775] Please add a secure way to clear and free memory
- Auto-submitted: auto-generated
- References: <bug-24775-131@http.sourceware.org/bugzilla/>
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.