mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-24 00:41:11 -04:00
malloc_usable_size: clean abort on invalid region
It's the region pointer that can be NULL here, and p was checked at the beginning of the function. Also fix the test accordingly.
This commit is contained in:
parent
5c8b686370
commit
76860c72e1
2 changed files with 5 additions and 3 deletions
|
@ -1630,7 +1630,7 @@ EXPORT size_t h_malloc_usable_size(H_MALLOC_USABLE_SIZE_CONST void *p) {
|
|||
struct region_allocator *ra = ro.region_allocator;
|
||||
mutex_lock(&ra->lock);
|
||||
struct region_metadata *region = regions_find(p);
|
||||
if (p == NULL) {
|
||||
if (region == NULL) {
|
||||
fatal_error("invalid malloc_usable_size");
|
||||
}
|
||||
size_t size = region->size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue