00001 /* 00002 * Segfault application 00003 * 00004 * An application to provoke a segmentation fault from the dialplan. 00005 * (I know what you are thinking now...., but since Asterisk is too stable... 00006 * I needed something to test my failover switches.) 00007 * 00008 * Copyright (C) 2005 Junghanns.NET GmbH 00009 * Klaus-Peter Junghanns <kpj@junghanns.net> 00010 * 00011 * This program is free software, distributed under the terms of 00012 * the GNU General Public License. THIS APPLICATION _WILL_ CRASH YOUR 00013 * ASTERISK SERVER SO OF COURSE THERE IS NOT LIABILITY FOR NOTHING! 00014 */ 00015 00016 #include "asterisk.h" 00017 00018 #include <stdlib.h> 00019 #include <unistd.h> 00020 #include <string.h> 00021 #include <stdio.h> 00022 #include <asterisk/lock.h> 00023 #include <asterisk/file.h> 00024 #include <asterisk/logger.h> 00025 #include <asterisk/channel.h> 00026 #include <asterisk/pbx.h> 00027 #include <asterisk/module.h> 00028 00029 static char *app = "Segfault"; 00030 00031 static char *synopsis = "This application will crash Asterisk with a segmentation fault."; 00032 00033 static char *descrip = 00034 " Segfault(): Crash with a segfault. Never returns nufin.\n"; 00035 00036 static int segfault_exec(struct ast_channel *chan, void *data) 00037 { 00038 ((char *)0)[0] = 0; 00039 return 0; 00040 } 00041 00042 static int unload_module(void) 00043 { 00044 return ast_unregister_application(app); 00045 } 00046 00047 static int load_module(void) 00048 { 00049 return ast_register_application(app, segfault_exec, synopsis, descrip); 00050 } 00051 00052 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Application for crashing Asterisk with a segmentation fault", 00053 .load = load_module, 00054 .unload = unload_module, 00055 );