summaryrefslogtreecommitdiff
path: root/funcs/func_config.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-10-08 18:19:59 +0000
committerKinsey Moore <kmoore@digium.com>2013-10-08 18:19:59 +0000
commit4e72ad1b4fe1c2b0cda6849df6aa28d9e8f13222 (patch)
treeb67bc9d420714d65e2e17d420bc7dcb0869ca844 /funcs/func_config.c
parent4873c11f64e80d2c31676db899cff0abd4b8c145 (diff)
Fix func_config list entry allocation
The AST_CONFIG dialplan function defined in func_config.c allocates its config file list entries using ast_malloc. List entry allocations destined for use with Asterisk's linked list API must be ast_calloc()d or otherwise initialized so that list pointers are set to NULL. These uses of ast_malloc have been replaced by ast_calloc to prevent dereferencing of uninitialized pointer values when traversing the list. (closes issue ASTERISK-22483) Reported by: Brian Scott ........ Merged revisions 400694 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 400697 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 400701 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400704 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_config.c')
-rw-r--r--funcs/func_config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/funcs/func_config.c b/funcs/func_config.c
index cbc51aaae..d45ad2c82 100644
--- a/funcs/func_config.c
+++ b/funcs/func_config.c
@@ -120,7 +120,7 @@ static int config_function_read(struct ast_channel *chan, const char *cmd, char
/* At worst, we might leak an entry while upgrading locks */
AST_RWLIST_UNLOCK(&configs);
AST_RWLIST_WRLOCK(&configs);
- if (!(cur = ast_malloc(sizeof(*cur) + strlen(args.filename) + 1))) {
+ if (!(cur = ast_calloc(1, sizeof(*cur) + strlen(args.filename) + 1))) {
AST_RWLIST_UNLOCK(&configs);
return -1;
}
@@ -149,7 +149,7 @@ static int config_function_read(struct ast_channel *chan, const char *cmd, char
}
if (!cur) {
- if (!(cur = ast_malloc(sizeof(*cur) + strlen(args.filename) + 1))) {
+ if (!(cur = ast_calloc(1, sizeof(*cur) + strlen(args.filename) + 1))) {
AST_RWLIST_UNLOCK(&configs);
return -1;
}