[asterisk-commits] qwell: trunk r105006 - in /trunk: ./ main/cdr.c main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 28 13:21:15 CST 2008


Author: qwell
Date: Thu Feb 28 13:21:15 2008
New Revision: 105006

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105006
Log:
Merged revisions 105005 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105005 | qwell | 2008-02-28 13:20:10 -0600 (Thu, 28 Feb 2008) | 9 lines

Make pbx_exec pass an empty string into applications, if we get NULL.
This protects against possible segfaults in applications that may try
 to use data before checking length (ast_strdupa'ing it, for example)

(closes issue #12100)
Reported by: foxfire
Patches:
      12100-nullappargs.diff uploaded by qwell (license 4)

........

Modified:
    trunk/   (props changed)
    trunk/main/cdr.c
    trunk/main/pbx.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cdr.c?view=diff&rev=105006&r1=105005&r2=105006
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Thu Feb 28 13:21:15 2008
@@ -780,12 +780,8 @@
 	for (; cdr; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			check_post(cdr);
-			if (!app)
-				app = "";
-			ast_copy_string(cdr->lastapp, app, sizeof(cdr->lastapp));
-			if (!data)
-				data = "";
-			ast_copy_string(cdr->lastdata, data, sizeof(cdr->lastdata));
+			ast_copy_string(cdr->lastapp, S_OR(app, ""), sizeof(cdr->lastapp));
+			ast_copy_string(cdr->lastdata, S_OR(data, ""), sizeof(cdr->lastdata));
 		}
 	}
 }

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=105006&r1=105005&r2=105006
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Thu Feb 28 13:21:15 2008
@@ -714,7 +714,7 @@
 	const char *saved_c_appl;
 	const char *saved_c_data;
 
-	if (c->cdr &&  !ast_check_hangup(c))
+	if (c->cdr && !ast_check_hangup(c))
 		ast_cdr_setapp(c->cdr, app->name, data);
 
 	/* save channel values */
@@ -725,7 +725,7 @@
 	c->data = data;
 	if (app->module)
 		u = __ast_module_user_add(app->module, c);
-	res = app->execute(c, data);
+	res = app->execute(c, S_OR(data, ""));
 	if (app->module && u)
 		__ast_module_user_remove(app->module, u);
 	/* restore channel values */




More information about the asterisk-commits mailing list