[asterisk-commits] kmoore: branch 11 r400697 - in /branches/11: ./ funcs/func_config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 8 13:18:22 CDT 2013


Author: kmoore
Date: Tue Oct  8 13:18:21 2013
New Revision: 400697

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400697
Log:
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

Modified:
    branches/11/   (props changed)
    branches/11/funcs/func_config.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/funcs/func_config.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/funcs/func_config.c?view=diff&rev=400697&r1=400696&r2=400697
==============================================================================
--- branches/11/funcs/func_config.c (original)
+++ branches/11/funcs/func_config.c Tue Oct  8 13:18:21 2013
@@ -120,7 +120,7 @@
 			/* 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 @@
 		}
 
 		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;
 			}




More information about the asterisk-commits mailing list