[svn-commits] rmudgett: branch 13 r420879 - /branches/13/res/res_stasis_snoop.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 12 18:33:07 CDT 2014


Author: rmudgett
Date: Tue Aug 12 18:33:00 2014
New Revision: 420879

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

Modified:
    branches/13/res/res_stasis_snoop.c

Modified: branches/13/res/res_stasis_snoop.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_stasis_snoop.c?view=diff&rev=420879&r1=420878&r2=420879
==============================================================================
--- branches/13/res/res_stasis_snoop.c (original)
+++ branches/13/res/res_stasis_snoop.c Tue Aug 12 18:33:00 2014
@@ -333,7 +333,7 @@
 		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 @@
 	/* 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);




More information about the svn-commits mailing list