aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-28 19:21:15 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-28 19:21:15 +0000
commite1ed25d450d4c5985fb48f22f4b019d74e1a9077 (patch)
tree3ab8b14714e048e08df5588e9fd88c7a0f78652d
parent92f2e9730554b7762f91b835d26c91cdf900090d (diff)
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) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@105006 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/cdr.c8
-rw-r--r--main/pbx.c4
2 files changed, 4 insertions, 8 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 00d66afec..929ebcef4 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -780,12 +780,8 @@ void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
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));
}
}
}
diff --git a/main/pbx.c b/main/pbx.c
index d790dddf1..3c42a6233 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -714,7 +714,7 @@ int pbx_exec(struct ast_channel *c, /*!< Channel */
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 @@ int pbx_exec(struct ast_channel *c, /*!< Channel */
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 */