[asterisk-commits] tilghman: branch 1.4 r154060 - /branches/1.4/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 3 15:48:21 CST 2008


Author: tilghman
Date: Mon Nov  3 15:48:21 2008
New Revision: 154060

URL: http://svn.digium.com/view/asterisk?view=rev&rev=154060
Log:
Remove the potential for a division by zero error.
(Closes issue #13810)

Modified:
    branches/1.4/main/rtp.c

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=154060&r1=154059&r2=154060
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Mon Nov  3 15:48:21 2008
@@ -1919,7 +1919,7 @@
 	}
 	
 	/* 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;




More information about the asterisk-commits mailing list