summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-07-11 23:05:34 +0000
committerRussell Bryant <russell@russellbryant.com>2007-07-11 23:05:34 +0000
commit08b1a342e54c477f924b52285a689bfe4781a6cd (patch)
tree6cc093e4f5f41f40c5f31cd395ca04704f9a2a3f /channels
parent66449656d3407e85d0eaecf4715865f3f6f50b1e (diff)
Merged revisions 74767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r74767 | russell | 2007-07-11 17:57:07 -0500 (Wed, 11 Jul 2007) | 13 lines Merged revisions 74766 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r74766 | russell | 2007-07-11 17:53:26 -0500 (Wed, 11 Jul 2007) | 5 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@74769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-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 fdb0f6dcc..2e452c389 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -7246,7 +7246,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)
@@ -8519,8 +8521,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_TRANSFERMEDIA | 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_string_field_set(iaxs[callno], host, pds.peer);