projects
/
asterisk/asterisk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c4ebf00
)
prevent copying of NULL (bug #4307)
author
Russell Bryant
<russell@russellbryant.com>
Tue, 17 May 2005 16:45:42 +0000
(16:45 +0000)
committer
Russell Bryant
<russell@russellbryant.com>
Tue, 17 May 2005 16:45:42 +0000
(16:45 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5708
65c4cc65
-6c06-0410-ace0-
fbb531ad65f3
funcs/func_logic.c
patch
|
blob
|
history
diff --git
a/funcs/func_logic.c
b/funcs/func_logic.c
index
d20b771
..
8df1732
100755
(executable)
--- a/
funcs/func_logic.c
+++ b/
funcs/func_logic.c
@@
-52,12
+52,14
@@
static char *builtin_function_if(struct ast_channel *chan, char *cmd, char *data
*iffalse = '\0';
iffalse++;
}
- } else
- iffalse = "";
+ }
+
if (expr && iftrue) {
ret = ast_true(expr) ? iftrue : iffalse;
- strncpy(buf, ret, len);
- ret = buf;
+ if (ret) {
+ ast_copy_string(buf, ret, len);
+ ret = buf;
+ }
} else {
ast_log(LOG_WARNING, "Syntax $(if <expr>?[<truecond>][:<falsecond>])\n");
ret = NULL;