[asterisk-commits] murf: branch 1.4 r86902 - /branches/1.4/funcs/func_logic.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 23 16:18:09 CDT 2007
Author: murf
Date: Tue Oct 23 16:18:08 2007
New Revision: 86902
URL: http://svn.digium.com/view/asterisk?view=rev&rev=86902
Log:
closes issue #11052 -- where nothing after the ? will allow un-initialized variable values to corrupt and crash asterisk on 64-bit platforms
Modified:
branches/1.4/funcs/func_logic.c
Modified: branches/1.4/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_logic.c?view=diff&rev=86902&r1=86901&r2=86902
==============================================================================
--- branches/1.4/funcs/func_logic.c (original)
+++ branches/1.4/funcs/func_logic.c Tue Oct 23 16:18:08 2007
@@ -99,12 +99,19 @@
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;
}
More information about the asterisk-commits
mailing list