[asterisk-commits] sgriepentrog: branch 11 r433086 - /branches/11/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 17 17:28:43 CDT 2015


Author: sgriepentrog
Date: Tue Mar 17 17:28:41 2015
New Revision: 433086

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=433086
Log:
Various: backport of bugfixes found via chaos

Using DEBUG_CHAOS several instances of a null
pointer crash, and one uninitialized variable
were uncovered and fixed.  Also added details
on why Asterisk failed to initialize.

This is a backport of the fixes from Asterisk
13.

Review: https://reviewboard.asterisk.org/r/4468/

Modified:
    branches/11/main/asterisk.c
    branches/11/main/utils.c
    branches/11/main/xmldoc.c

Modified: branches/11/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/asterisk.c?view=diff&rev=433086&r1=433085&r2=433086
==============================================================================
--- branches/11/main/asterisk.c (original)
+++ branches/11/main/asterisk.c Tue Mar 17 17:28:41 2015
@@ -4145,39 +4145,39 @@
 	ast_builtins_init();
 
 	if (ast_utils_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_utils_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_tps_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_tps_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_fd_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_fd_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_pbx_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_pbx_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_event_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_event_init\n%s", term_quit());
 		exit(1);
 	}
 
 #ifdef TEST_FRAMEWORK
 	if (ast_test_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_test_init\n%s", term_quit());
 		exit(1);
 	}
 #endif
 
 	if (ast_translate_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_translate_init\n%s", term_quit());
 		exit(1);
 	}
 
@@ -4204,7 +4204,7 @@
 	initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
 
 	if (init_logger()) {		/* Start logging subsystem */
-		printf("%s", term_quit());
+		printf("Failed: init_logger\n%s", term_quit());
 		exit(1);
 	}
 
@@ -4217,12 +4217,12 @@
 	ast_autoservice_init();
 
 	if (ast_timing_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_timing_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_ssl_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_ssl_init\n%s", term_quit());
 		exit(1);
 	}
 
@@ -4232,62 +4232,62 @@
 #endif
 
 	if (astdb_init()) {
-		printf("%s", term_quit());
+		printf("Failed: astdb_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_msg_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_msg_init\n%s", term_quit());
 		exit(1);
 	}
 
 	/* initialize the data retrieval API */
 	if (ast_data_init()) {
-		printf ("%s", term_quit());
+		printf ("Failed: ast_data_init\n%s", term_quit());
 		exit(1);
 	}
 
 	ast_channels_init();
 
 	if ((moduleresult = load_modules(1))) {		/* Load modules, pre-load only */
-		printf("%s", term_quit());
+		printf("Failed: load_modules(1)\n%s", term_quit());
 		exit(moduleresult == -2 ? 2 : 1);
 	}
 
 	if (dnsmgr_init()) {		/* Initialize the DNS manager */
-		printf("%s", term_quit());
+		printf("Failed: dnsmgr_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_named_acl_init()) { /* Initialize the Named ACL system */
-		printf("%s", term_quit());
+		printf("Failed: ast_named_acl_init\n%s", term_quit());
 		exit(1);
 	}
 
 	ast_http_init();		/* Start the HTTP server, if needed */
 
 	if (init_manager()) {
-		printf("%s", term_quit());
+		printf("Failed: init_manager\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_cdr_engine_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_cdr_engine_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_cel_engine_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_cel_engine_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_device_state_engine_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_device_state_engine_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_presence_state_engine_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_presence_state_engine_init\n%s", term_quit());
 		exit(1);
 	}
 
@@ -4295,47 +4295,47 @@
 	ast_udptl_init();
 
 	if (ast_image_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_image_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_file_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_file_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (load_pbx()) {
-		printf("%s", term_quit());
+		printf("Failed: load_pbx\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_indications_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_indications_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_features_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_features_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (init_framer()) {
-		printf("%s", term_quit());
+		printf("Failed: init_framer\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_enum_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_enum_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if (ast_cc_init()) {
-		printf("%s", term_quit());
+		printf("Failed: ast_cc_init\n%s", term_quit());
 		exit(1);
 	}
 
 	if ((moduleresult = load_modules(0))) {		/* Load modules */
-		printf("%s", term_quit());
+		printf("Failed: load_modules(0)\n%s", term_quit());
 		exit(moduleresult == -2 ? 2 : 1);
 	}
 

Modified: branches/11/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/utils.c?view=diff&rev=433086&r1=433085&r2=433086
==============================================================================
--- branches/11/main/utils.c (original)
+++ branches/11/main/utils.c Tue Mar 17 17:28:41 2015
@@ -622,7 +622,7 @@
 }
 
 #ifdef HAVE_DEV_URANDOM
-static int dev_urandom_fd;
+static int dev_urandom_fd = -1;
 #endif
 
 #ifndef __linux__

Modified: branches/11/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/xmldoc.c?view=diff&rev=433086&r1=433085&r2=433086
==============================================================================
--- branches/11/main/xmldoc.c (original)
+++ branches/11/main/xmldoc.c Tue Mar 17 17:28:41 2015
@@ -1974,6 +1974,9 @@
 		ast_xml_free_text(tmpstr);
 	} else {
 		ret = ast_str_create(128);
+		if (!ret) {
+			return NULL;
+		}
 		for (tmp = ast_xml_node_get_children(node); tmp; tmp = ast_xml_node_get_next(tmp)) {
 			/* if found, parse a <para> element. */
 			if (xmldoc_parse_common_elements(tmp, "", "\n", &ret)) {
@@ -2014,7 +2017,7 @@
 	}
 
 	formatted = xmldoc_get_formatted(node, raw, raw);
-	if (ast_str_strlen(formatted) > 0) {
+	if (formatted && ast_str_strlen(formatted) > 0) {
 		ret = ast_strdup(ast_str_buffer(formatted));
 	}
 	ast_free(formatted);




More information about the asterisk-commits mailing list