Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
return 0;
}
+/*
+ Causes a segmentation fault so this program is being terminated
+*/
+static int _segv(int argc, char* argv[]) {
+ char* p = NULL;
+
+ // Storing a value to the NULL pointer
+ *p = 'a';
+
+ return 0;
+}
+
int main(int argc, char* argv[]) {
if (argc < 2) {
fprintf(stderr, "No command given\n");
else if (strcmp(command, "print-pid") == 0)
callback = print_pid;
+ // SEGV
+ else if (strcmp(command, "segv") == 0)
+ callback = _segv;
+
// Send signal
else if (strcmp(command, "send-signal") == 0)
callback = send_signal;