diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-07-31 20:21:43 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-07-31 20:21:43 +0000 |
commit | 9b16c8b0f6c3b6310e303411421bfcb16b26c3c4 (patch) | |
tree | 273c31a834a21bd2239ec6b83cd35c602ea25d26 /apps/app_while.c | |
parent | 6c23a60f802e7708389b1a6463a40dc0500512bd (diff) |
Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().
(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........
Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_while.c')
-rw-r--r-- | apps/app_while.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/app_while.c b/apps/app_while.c index d1e03f600..90d3d5826 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -236,7 +236,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) condition = ast_strdupa(data); size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; - my_name = alloca(size); + my_name = ast_alloca(size); memset(my_name, 0, size); snprintf(my_name, size, "%s_%s_%d", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)); @@ -281,7 +281,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) if (!end && !while_pri) { char *goto_str; size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; - goto_str = alloca(size); + goto_str = ast_alloca(size); memset(goto_str, 0, size); snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)); pbx_builtin_setvar_helper(chan, varname, goto_str); @@ -293,7 +293,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) if (! pbx_builtin_getvar_helper(chan, end_varname)) { char *goto_str; size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; - goto_str = alloca(size); + goto_str = ast_alloca(size); memset(goto_str, 0, size); snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)+1); pbx_builtin_setvar_helper(chan, end_varname, goto_str); |