[Asterisk-code-review] res_rtp_asterisk.c: Fix signed mismatch that leads to overflow (asterisk[17])

George Joseph asteriskteam at digium.com
Thu Feb 18 10:27:40 CST 2021


Hello Sean Bright,

I'd like you to do a code review. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/15488

to review the following change.


Change subject: res_rtp_asterisk.c: Fix signed mismatch that leads to overflow
......................................................................

res_rtp_asterisk.c: Fix signed mismatch that leads to overflow

ASTERISK-29205 #close

Change-Id: Ib7aa65644e8df76e2378d7613ee7cf751b9d0bea
---
M res/res_rtp_asterisk.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/88/15488/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 1820ab1..2ed1831 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -6871,7 +6871,7 @@
 			/* If there is no more room left for storing packets stop now, we leave 20
 			 * extra bits at the end just in case.
 			 */
-			if ((sizeof(bdata) - (packet_len + delta_len + 20)) < 0) {
+			if (packet_len + delta_len + 20 > sizeof(bdata)) {
 				res = -1;
 				break;
 			}
@@ -6905,7 +6905,7 @@
 		previous_packet = statistics;
 
 		/* If there is no more room left in the packet stop handling of any subsequent packets */
-		if ((sizeof(bdata) - (packet_len + delta_len + 20)) < 0) {
+		if (packet_len + delta_len + 20 > sizeof(bdata)) {
 			break;
 		}
 	}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15488
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: Ib7aa65644e8df76e2378d7613ee7cf751b9d0bea
Gerrit-Change-Number: 15488
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210218/f937fb09/attachment.html>


More information about the asterisk-code-review mailing list