diff options
-rw-r--r-- | tests/bad-write.c | 11 | ||||
-rwxr-xr-x | tests/run-test.sh | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/bad-write.c b/tests/bad-write.c new file mode 100644 index 0000000..5f63e80 --- /dev/null +++ b/tests/bad-write.c @@ -0,0 +1,11 @@ +#include <unistd.h> +#include <stdio.h> + +int main(void) +{ + char *c = NULL; + + c[0] = 'a'; + + return 0; +} diff --git a/tests/run-test.sh b/tests/run-test.sh new file mode 100755 index 0000000..781fb81 --- /dev/null +++ b/tests/run-test.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +exec 2> /dev/null +ulimit -c unlimited + +original_core_pattern=$(cat /proc/sys/kernel/core_pattern) + +sudo echo "$PWD/core" | sudo tee /proc/sys/kernel/core_pattern > /dev/null + +./bad-write + +sudo echo "$original_core_pattern" | sudo tee /proc/sys/kernel/core_pattern > /dev/null |