summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2016-02-03 15:14:53 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-02-03 15:14:53 -0600
commit0389555c12bee34405c2b89e82a691e4478e11e6 (patch)
treeb5839ac6e73d7b3b05efefae82fd1e5ef33efdbf
parent0de74fad5597ba12ec68bcc935330a612ee255d6 (diff)
parenta877e0d94b263bcb3d2b378dc952b759d58a2b43 (diff)
Merge "AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow."
-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 10b0d23f2..aaf0b6d51 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3970,6 +3970,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;