aboutsummaryrefslogtreecommitdiffstats
path: root/main/rtp.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-03 21:48:21 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-03 21:48:21 +0000
commite7cdd93b9a6b7ca76be96c7afa3fbea752eb6def (patch)
tree109763d4c770d27e6e055a79f284d187f999f87d /main/rtp.c
parent18a994a6bd010c8cc2aaf4ab71cac668456478f3 (diff)
Remove the potential for a division by zero error.
(Closes issue #13810) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@154060 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r--main/rtp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/rtp.c b/main/rtp.c
index 2fd470741..31562e0d8 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -1919,7 +1919,7 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
}
/* Select a random port number in the range of possible RTP */
- x = (ast_random() % (rtpend-rtpstart)) + rtpstart;
+ x = (rtpend == rtpstart) ? rtpstart : (ast_random() % (rtpend - rtpstart)) + rtpstart;
x = x & ~1;
/* Save it for future references. */
startplace = x;