mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-23 08:21:24 -04:00
use SLAB_CANARY for conditional checks
This commit is contained in:
parent
7d6663ed80
commit
3696f071a4
2 changed files with 2 additions and 6 deletions
|
@ -673,7 +673,7 @@ static inline void deallocate_small(void *p, const size_t *expected_size) {
|
|||
}
|
||||
|
||||
if (!is_zero_size) {
|
||||
if (canary_size) {
|
||||
if (SLAB_CANARY) {
|
||||
u64 canary_value;
|
||||
memcpy(&canary_value, (char *)p + size - canary_size, canary_size);
|
||||
if (unlikely(canary_value != metadata->canary_value)) {
|
||||
|
@ -1589,7 +1589,7 @@ static inline void memory_corruption_check_small(const void *p) {
|
|||
fatal_error("invalid malloc_usable_size");
|
||||
}
|
||||
|
||||
if (!is_zero_size && canary_size) {
|
||||
if (!is_zero_size && SLAB_CANARY) {
|
||||
u64 canary_value;
|
||||
memcpy(&canary_value, (const char *)p + size - canary_size, canary_size);
|
||||
if (unlikely(canary_value != metadata->canary_value)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue