mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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. ........ Merged revisions 420879 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user