diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-03 22:04:01 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-03 22:04:01 +0000 |
commit | a2553ecb8dd7dfc0ea8759d6beb5546593f8efc2 (patch) | |
tree | 26610996c7ecae6331d82bf0ddb0fe3c405aaaee /main/rtp.c | |
parent | 7afc018f283a02a9c71a46e76a1f7c7e1a4ec62b (diff) |
Merged revisions 154060 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r154060 | tilghman | 2008-11-03 15:48:21 -0600 (Mon, 03 Nov 2008) | 3 lines
Remove the potential for a division by zero error.
(Closes issue #13810)
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@154062 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r-- | main/rtp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/main/rtp.c b/main/rtp.c index 46107e33e..f78d96176 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -66,8 +66,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static int dtmftimeout = DEFAULT_DTMF_TIMEOUT; -static int rtpstart; /*!< First port for RTP sessions (set in rtp.conf) */ -static int rtpend; /*!< Last port for RTP sessions (set in rtp.conf) */ +static int rtpstart = 5000; /*!< First port for RTP sessions (set in rtp.conf) */ +static int rtpend = 31000; /*!< Last port for RTP sessions (set in rtp.conf) */ static int rtpdebug; /*!< Are we debugging? */ static int rtcpdebug; /*!< Are we debugging RTCP? */ static int rtcpstats; /*!< Are we debugging RTCP? */ @@ -2248,7 +2248,7 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io * next one, cannot be enforced in presence of a NAT box because the * mapping is not under our control. */ - x = (ast_random() % (rtpend-rtpstart)) + rtpstart; + x = (rtpend == rtpstart) ? rtpstart : (ast_random() % (rtpend - rtpstart)) + rtpstart; x = x & ~1; /* make it an even number */ startplace = x; /* remember the starting point */ /* this is constant across the loop */ |