mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
prevent copying of NULL (bug #4307)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5708 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -52,12 +52,14 @@ static char *builtin_function_if(struct ast_channel *chan, char *cmd, char *data
|
|||||||
*iffalse = '\0';
|
*iffalse = '\0';
|
||||||
iffalse++;
|
iffalse++;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
iffalse = "";
|
|
||||||
if (expr && iftrue) {
|
if (expr && iftrue) {
|
||||||
ret = ast_true(expr) ? iftrue : iffalse;
|
ret = ast_true(expr) ? iftrue : iffalse;
|
||||||
strncpy(buf, ret, len);
|
if (ret) {
|
||||||
|
ast_copy_string(buf, ret, len);
|
||||||
ret = buf;
|
ret = buf;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Syntax $(if <expr>?[<truecond>][:<falsecond>])\n");
|
ast_log(LOG_WARNING, "Syntax $(if <expr>?[<truecond>][:<falsecond>])\n");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
Reference in New Issue
Block a user