]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow. 69/2169/2
authorRichard Mudgett <rmudgett@digium.com>
Mon, 28 Sep 2015 22:07:42 +0000 (17:07 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 3 Feb 2016 21:04:26 +0000 (15:04 -0600)
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

channels/chan_sip.c

index 6ebdd94ad76b404e1221471c588f9d7ef384cb39..db3c49f68e317d0bb4eea039da3fe7dd2e94391e 100644 (file)
@@ -3980,6 +3980,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;