Change in osmo-mgw[master]: check_rtp_origin(): Don't memcmp sockadd_in and in_addr

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Oct 25 18:06:40 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11402 )

Change subject: check_rtp_origin(): Don't memcmp sockadd_in and in_addr
......................................................................

check_rtp_origin(): Don't memcmp sockadd_in and in_addr

We were comparing 16 bytes (sockaddr_in) in memcmp() rather than using
four bytes (struct in_addr in mgcp conn end).

This is a good example why we should actually simply use the == (equals)
operator rather than using memcmp which treats everything as void.

Change-Id: Ic64256619ef893d625400e8b1b573ea2c629ed9c
Fixes: Coverity CID#188874
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index d769ef3..fe63f1e 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -874,7 +874,7 @@
 	endp = conn->conn->endp;
 	struct sockaddr_in zero_addr = {};
 
-	if (memcmp(&zero_addr, &conn->end.addr, sizeof(zero_addr)) == 0) {
+	if (memcmp(&zero_addr.sin_addr, &conn->end.addr, sizeof(zero_addr.sin_addr)) == 0) {
 		switch (conn->conn->mode) {
 		case MGCP_CONN_LOOPBACK:
 			/* HACK: for IuUP, we want to reply with an IuUP Initialization ACK upon the first RTP

-- 
To view, visit https://gerrit.osmocom.org/11402
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic64256619ef893d625400e8b1b573ea2c629ed9c
Gerrit-Change-Number: 11402
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181025/c1b0d184/attachment.htm>


More information about the gerrit-log mailing list