aboutsummaryrefslogtreecommitdiffstats
path: root/main/cdr.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-28 19:20:10 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-28 19:20:10 +0000
commita166a1242cd1f6e9f17f965853d07097a59aab68 (patch)
treea7f02e6efa00b35ba4ce414ded15cc8322a20204 /main/cdr.c
parentdfe3905779e35a7c1d7c4fb41703088e8cca4b0c (diff)
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/branches/1.4@105005 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/main/cdr.c b/main/cdr.c
index b3fcf08ee..ee0086444 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -787,12 +787,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));
}
}
}