summaryrefslogtreecommitdiff
path: root/apps/app_chanspy.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2008-08-20 22:16:36 +0000
committerRussell Bryant <russell@russellbryant.com>2008-08-20 22:16:36 +0000
commit89eaa39a6a76a95f293afe23f7312e417560d1d8 (patch)
treea71a0e526be5adb47f17b23ca9bcfaa6429d1bd4 /apps/app_chanspy.c
parentd22fe173222decc4b2edc6700cf134a3de2f41b1 (diff)
Merged revisions 139213 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r139213 | russell | 2008-08-20 17:14:35 -0500 (Wed, 20 Aug 2008) | 11 lines Fix a crash in the ChanSpy application. The issue here is that if you call ChanSpy and specify a spy group, and sit in the application long enough looping through the channel list, you will eventually run out of stack space and the application with exit with a seg fault. The backtrace was always inside of a harmless snprintf() call, so it was tricky to track down. However, it turned out that the call to snprintf() was just the biggest stack consumer in this code path, so it would always be the first one to hit the boundary. (closes issue #13338) Reported by: ruddy ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@139215 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_chanspy.c')
-rw-r--r--apps/app_chanspy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 81b193110..dea2017ea 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -713,7 +713,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
char *groups[NUM_SPYGROUPS];
char *mygroups[NUM_SPYGROUPS];
int num_groups = 0;
- char *dup_group;
+ char dup_group[512];
int num_mygroups = 0;
char *dup_mygroup;
int x;
@@ -757,7 +757,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
ARRAY_LEN(mygroups));
if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) {
- dup_group = ast_strdupa(group);
+ ast_copy_string(dup_group, group, sizeof(dup_group));
num_groups = ast_app_separate_args(dup_group, ':', groups,
ARRAY_LEN(groups));
}