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

Joshua Colp asteriskteam at digium.com
Thu Feb 18 10:26:36 CST 2021


Hello Sean Bright,

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

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

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/77/15477/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index dfec8f5..29ffffc 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -6932,7 +6932,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;
 			}
@@ -6966,7 +6966,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/+/15477
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18.2
Gerrit-Change-Id: Ib7aa65644e8df76e2378d7613ee7cf751b9d0bea
Gerrit-Change-Number: 15477
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.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/3452f57e/attachment-0001.html>


More information about the asterisk-code-review mailing list