aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-23 21:25:37 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-23 21:25:37 +0000
commit08a1f8a741f6a236feea6025b463cd7880733df2 (patch)
treea25b4cb5fb556a5b1dbd3e77092d430f164e5e53 /funcs
parent2323883d4f4d1abf754dd612140f372c35309cc0 (diff)
Merged revisions 86902 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r86902 | murf | 2007-10-23 15:18:08 -0600 (Tue, 23 Oct 2007) | 1 line closes issue #11052 -- where nothing after the ? will allow un-initialized variable values to corrupt and crash asterisk on 64-bit platforms ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@86903 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_logic.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/funcs/func_logic.c b/funcs/func_logic.c
index 4ab9ed463..aff358c24 100644
--- a/funcs/func_logic.c
+++ b/funcs/func_logic.c
@@ -101,12 +101,19 @@ static int acf_if(struct ast_channel *chan, const char *cmd, char *data, char *b
AST_APP_ARG(iftrue);
AST_APP_ARG(iffalse);
);
-
+ args2.iftrue = args2.iffalse = NULL; /* you have to set these, because if there is nothing after the '?',
+ then args1.remainder will be NULL, not a pointer to a null string, and
+ then any garbage in args2.iffalse will not be cleared, and you'll crash.
+ -- and if you mod the ast_app_separate_args func instead, you'll really
+ mess things up badly, because the rest of everything depends on null args
+ for non-specified stuff. */
+
AST_NONSTANDARD_APP_ARGS(args1, data, '?');
AST_NONSTANDARD_APP_ARGS(args2, args1.remainder, ':');
if (ast_strlen_zero(args1.expr) || !(args2.iftrue || args2.iffalse)) {
- ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>])\n");
+ ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>]) (expr must be non-null, and either <true> or <false> must be non-null)\n");
+ ast_log(LOG_WARNING, " In this case, <expr>='%s', <true>='%s', and <false>='%s'\n", args1.expr, args2.iftrue, args2.iffalse);
return -1;
}