[asterisk-commits] bebuild: tag certified-11.6-cert1-rc2 r405579 - in /certified/tags/11.6-cert1...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 15 09:39:58 CST 2014


Author: bebuild
Date: Wed Jan 15 09:39:54 2014
New Revision: 405579

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405579
Log:
Merge r405578, update ChangeLog/summaries

Removed:
    certified/tags/11.6-cert1-rc2/certified-asterisk-11.6-cert1-rc2-summary.html
    certified/tags/11.6-cert1-rc2/certified-asterisk-11.6-cert1-rc2-summary.txt
Modified:
    certified/tags/11.6-cert1-rc2/   (props changed)
    certified/tags/11.6-cert1-rc2/ChangeLog
    certified/tags/11.6-cert1-rc2/main/pbx.c

Propchange: certified/tags/11.6-cert1-rc2/
------------------------------------------------------------------------------
--- branch-11-merged (original)
+++ branch-11-merged Wed Jan 15 09:39:54 2014
@@ -1,1 +1,1 @@
-/branches/11:396884,399513,400075-400093,401446,401960,402450,403917,404344,405215,405380,405431
+/branches/11:396884,399513,400075-400093,401446,401960,402450,403863,403917,404344,405215,405380,405431

Propchange: certified/tags/11.6-cert1-rc2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 15 09:39:54 2014
@@ -1,3 +1,3 @@
 /branches/11:399513,401167,401179,401182
 /certified/branches/1.8.15:382389
-/certified/branches/11.6:403860,403956,404349,405233,405488,405536
+/certified/branches/11.6:403860,403956,404349,405233,405488,405536,405578

Modified: certified/tags/11.6-cert1-rc2/ChangeLog
URL: http://svnview.digium.com/svn/asterisk/certified/tags/11.6-cert1-rc2/ChangeLog?view=diff&rev=405579&r1=405578&r2=405579
==============================================================================
--- certified/tags/11.6-cert1-rc2/ChangeLog (original)
+++ certified/tags/11.6-cert1-rc2/ChangeLog Wed Jan 15 09:39:54 2014
@@ -1,6 +1,23 @@
-2014-01-14  Asterisk Development Team <asteriskteam at digium.com>
+2014-01-15  Asterisk Development Team <asteriskteam at digium.com>
 
 	* Asterisk 11.6-cert1-rc2 Released.
+
+	* pbx.c: put copy of ast_exten.data on stack to prevent memory
+	  corruption
+
+	  During dialplan execution in pbx_extension_helper(), the contexts
+	  global read lock prevents link list corruption, but was released with
+	  a pointer to the ast_exten and data later used in variable
+	  substitution. Instead, this patch removes pbx_substitute_variables()
+	  and locates a copy of the ast_exten data on the stack before
+	  releasing the lock, where ast_exten could get free'd by another
+	  thread performing a module reload.
+
+	  (issue AST-1179)
+	  Reported by: Thomas Arimont
+	  (issue AST-1246)
+	  Reported by: Alexander Hömig
+	  Review: https://reviewboard.asterisk.org/r/3055/
 
 	* chan_sip: Hangup transferer/transferee when transfer to Parking fails
 

Modified: certified/tags/11.6-cert1-rc2/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/certified/tags/11.6-cert1-rc2/main/pbx.c?view=diff&rev=405579&r1=405578&r2=405579
==============================================================================
--- certified/tags/11.6-cert1-rc2/main/pbx.c (original)
+++ certified/tags/11.6-cert1-rc2/main/pbx.c Wed Jan 15 09:39:54 2014
@@ -4805,25 +4805,6 @@
 	pbx_substitute_variables_helper_full(NULL, headp, cp1, cp2, count, &used);
 }
 
-static void pbx_substitute_variables(char *passdata, int datalen, struct ast_channel *c, struct ast_exten *e)
-{
-	const char *tmp;
-
-	/* Nothing more to do */
-	if (!e->data) {
-		*passdata = '\0';
-		return;
-	}
-
-	/* No variables or expressions in e->data, so why scan it? */
-	if ((!(tmp = strchr(e->data, '$'))) || (!strstr(tmp, "${") && !strstr(tmp, "$["))) {
-		ast_copy_string(passdata, e->data, datalen);
-		return;
-	}
-
-	pbx_substitute_variables_helper(c, e->data, passdata, datalen - 1);
-}
-
 /*!
  * \brief The return value depends on the action:
  *
@@ -4848,6 +4829,7 @@
 {
 	struct ast_exten *e;
 	struct ast_app *app;
+	char *substitute = NULL;
 	int res;
 	struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
 	char passdata[EXT_DATA_SIZE];
@@ -4873,6 +4855,18 @@
 			if (!e->cached_app)
 				e->cached_app = pbx_findapp(e->app);
 			app = e->cached_app;
+			if (ast_strlen_zero(e->data)) {
+				*passdata = '\0';
+			} else {
+				const char *tmp;
+				if ((!(tmp = strchr(e->data, '$'))) || (!strstr(tmp, "${") && !strstr(tmp, "$["))) {
+					/* no variables to substitute, copy on through */
+					ast_copy_string(passdata, e->data, sizeof(passdata));
+				} else {
+					/* save e->data on stack for later processing after lock released */
+					substitute = ast_strdupa(e->data);
+				}
+			}
 			ast_unlock_contexts();
 			if (!app) {
 				ast_log(LOG_WARNING, "No application '%s' for extension (%s, %s, %d)\n", e->app, context, exten, priority);
@@ -4883,7 +4877,9 @@
 			if (ast_channel_exten(c) != exten)
 				ast_channel_exten_set(c, exten);
 			ast_channel_priority_set(c, priority);
-			pbx_substitute_variables(passdata, sizeof(passdata), c, e);
+			if (substitute) {
+				pbx_substitute_variables_helper(c, substitute, passdata, sizeof(passdata)-1);
+			}
 #ifdef CHANNEL_TRACE
 			ast_channel_trace_update(c);
 #endif




More information about the asterisk-commits mailing list