[PATCH] osmo-mgw[master]: mgcp_test: fix wrong strcmp() parameters

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/.

dexter gerrit-no-reply at lists.osmocom.org
Mon Dec 4 16:17:48 UTC 2017


Review at  https://gerrit.osmocom.org/5172

mgcp_test: fix wrong strcmp() parameters

The CRCX string parameter lacks the quotes and the result of
the function call is not checked against zero. Also the
return code of get_conn_id_from_response() is not asserted.

Fixes: Coverity CID#180534

Change-Id: If4f3ed2c3572da196160569a9705b7a302b700a9
---
M tests/mgcp/mgcp_test.c
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/72/5172/1

diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index fb99911..86edf00 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -765,6 +765,7 @@
 	struct mgcp_config *cfg;
 	int i;
 	char last_conn_id[256];
+	int rc;
 
 	cfg = mgcp_config_alloc();
 
@@ -792,9 +793,11 @@
 			OSMO_ASSERT(false);
 		}
 
-		if (msg && strcmp(t->name, CRCX))
-			get_conn_id_from_response(msg->data, last_conn_id,
-						  sizeof(last_conn_id));
+		if (msg && strcmp(t->name, "CRCX") == 0) {
+		        rc = get_conn_id_from_response(msg->data, last_conn_id,
+						       sizeof(last_conn_id));
+			OSMO_ASSERT(rc == 0);
+		}
 
 		msgb_free(msg);
 

-- 
To view, visit https://gerrit.osmocom.org/5172
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4f3ed2c3572da196160569a9705b7a302b700a9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list