commit 8237514e5f550a161f8ba243bd1515a4415a1c3a
Author: Patricia Aas <psmaas@gmail.com>
AuthorDate: Tue Mar 22 20:59:53 2022 +0100
Commit: GitHub <noreply@github.com>
CommitDate: Tue Mar 22 20:59:53 2022 +0100
Fix unlink vulnerability in z_native.c (#1454)
* Fix for issue #1453
Check that the pointers are stil pointing at the block before the unlink is performed
* Set the right indentation
---
src/z_native.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/z_native.c b/src/z_native.c
index 0d52a622..c7f8f3cd 100644
--- a/src/z_native.c
+++ b/src/z_native.c
@@ -112,11 +112,19 @@ static void Z_RemoveBlock(memblock_t *block)
}
else
{
+ if (block->prev->next != block)
+ {
+ I_Error("Z_RemoveBlock: Doubly-linked list corrupted!");
+ }
block->prev->next = block->next;
}
if (block->next != NULL)
{
+ if (block->next->prev != block)
+ {
+ I_Error("Z_RemoveBlock: Doubly-linked list corrupted!");
+ }
block->next->prev = block->prev;
}
}