summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-09-28 17:07:42 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-02-03 15:04:50 -0600
commit3c81a052c88270a2bef6d4641559cf22837b31a6 (patch)
treebe482bce40604d393b60dc31aa22d0d778ea39db /channels
parent73159cb45f26e5f52605beb826cd955538912458 (diff)
AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow.
Setting the sip.conf timert1 value to a value higher than 1245 can cause an integer overflow and result in large retransmit timeout times. These large timeout times hold system file descriptors hostage and can cause the system to run out of file descriptors. NOTE: The default sip.conf timert1 value is 500 which does not expose the vulnerability. * The overflow is now detected and the previous timeout time is calculated. ASTERISK-25397 #close Reported by: Alexander Traud Change-Id: Ia7231f2f415af1cbf90b923e001b9219cff46290
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 60ff451c1..cc4fa88bd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3965,6 +3965,13 @@ static int retrans_pkt(const void *data)
}
/* For non-invites, a maximum of 4 secs */
+ if (INT_MAX / pkt->timer_a < pkt->timer_t1) {
+ /*
+ * Uh Oh, we will have an integer overflow.
+ * Recalculate previous timeout time instead.
+ */
+ pkt->timer_a = pkt->timer_a / 2;
+ }
siptimer_a = pkt->timer_t1 * pkt->timer_a; /* Double each time */
if (pkt->method != SIP_INVITE && siptimer_a > 4000) {
siptimer_a = 4000;