aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-11 22:53:26 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-11 22:53:26 +0000
commit4631f732a119b3b6b1e3c98a7eed091dd2603ee3 (patch)
tree3d3ffcf4eed406396a5975c2f43143dccf794cbe /channels/chan_iax2.c
parent3c88084e25cd93b36571864e39ac1d863534e8b7 (diff)
The function make_trunk() can fail and return -1 instead of a valid new call
number. Fix the uses of this function to handle this instead of treating it as the new call number. This would cause a deadlock and memory corruption. (possible cause of issue #9614 and others, patch by me) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@74766 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index c8007acba..5bc629fa3 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -6959,7 +6959,9 @@ retryowner:
check_provisioning(&sin, fd, ies.serviceident, ies.provver);
/* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
if (ast_test_flag(iaxs[fr->callno], IAX_TRUNK)) {
- fr->callno = make_trunk(fr->callno, 1);
+ int new_callno;
+ if ((new_callno = make_trunk(fr->callno, 1)) != -1)
+ fr->callno = new_callno;
}
/* For security, always ack immediately */
if (delayreject)
@@ -8072,8 +8074,11 @@ static struct ast_channel *iax2_request(const char *type, int format, void *data
/* If this is a trunk, update it now */
ast_copy_flags(iaxs[callno], &cai, IAX_TRUNK | IAX_SENDANI | IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
- if (ast_test_flag(&cai, IAX_TRUNK))
- callno = make_trunk(callno, 1);
+ if (ast_test_flag(&cai, IAX_TRUNK)) {
+ int new_callno;
+ if ((new_callno = make_trunk(callno, 1)) != -1)
+ callno = new_callno;
+ }
iaxs[callno]->maxtime = cai.maxtime;
if (cai.found)
ast_copy_string(iaxs[callno]->host, pds.peer, sizeof(iaxs[callno]->host));