diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-08-12 23:33:00 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-08-12 23:33:00 +0000 |
commit | bede29b76265450dca40b76b2eb74f6bb64b159d (patch) | |
tree | 6abba8ee8ced2e28f0c3a17e4157704147b21c24 /res/res_stasis_snoop.c | |
parent | a2bbe5d3601302fbe5eb59c44b0cb49651af84ff (diff) |
res_stasis_snoop.c: Fix off nominial exit path leaving Snoop channel locked and not hungup.
* Made use ast_copy_string() instead of strcpy() for snoop uniqueid for
safety. There is no guarantee that the max channel uniqueid length will
remain the same as the snoop uniqueid space.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_stasis_snoop.c')
-rw-r--r-- | res/res_stasis_snoop.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_stasis_snoop.c b/res/res_stasis_snoop.c index 72f851923..16d47f8ba 100644 --- a/res/res_stasis_snoop.c +++ b/res/res_stasis_snoop.c @@ -333,7 +333,7 @@ struct ast_channel *stasis_app_control_snoop(struct ast_channel *chan, return NULL; } - strcpy(snoop->uniqueid, ast_channel_uniqueid(chan)); + ast_copy_string(snoop->uniqueid, ast_channel_uniqueid(chan), sizeof(snoop->uniqueid)); /* To keep the channel valid on the Snoop structure until it is destroyed we bump the ref up here */ ast_channel_ref(snoop->chan); @@ -346,6 +346,8 @@ struct ast_channel *stasis_app_control_snoop(struct ast_channel *chan, /* The format on the Snoop channel will be this signed linear format, and it will never change */ caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT); if (!caps) { + ast_channel_unlock(snoop->chan); + ast_hangup(snoop->chan); return NULL; } ast_format_cap_append(caps, snoop->spy_format, 0); |