mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
lib: talloc: Add check for destructor protection.
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
f877191fee
commit
d820b046ac
@ -1865,6 +1865,11 @@ static void test_magic_protection_abort(const char *reason)
|
||||
}
|
||||
}
|
||||
|
||||
static int test_magic_protection_destructor(int *ptr)
|
||||
{
|
||||
_exit(404); /* Not 42 */
|
||||
}
|
||||
|
||||
static bool test_magic_protection(void)
|
||||
{
|
||||
void *pool = talloc_pool(NULL, 1024);
|
||||
@ -1883,6 +1888,7 @@ static bool test_magic_protection(void)
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
talloc_set_abort_fn(test_magic_protection_abort);
|
||||
talloc_set_destructor(p2, test_magic_protection_destructor);
|
||||
|
||||
/*
|
||||
* Simulate a security attack
|
||||
|
Loading…
x
Reference in New Issue
Block a user