Change in ...osmo-mgw[master]: Fix return variable of strtoul()

pespin gerrit-no-reply at lists.osmocom.org
Fri Jul 26 12:16:14 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/14966


Change subject: Fix return variable of strtoul()
......................................................................

Fix return variable of strtoul()

Return variable specified by strtoul() is "unsigned long int". If
"unsigned int" is used, according to Coverity the return value can never
be ULONG_MAX:

CID 202173:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
"pt == 18446744073709551615UL /* 9223372036854775807L * 2UL + 1UL */" is always false regardless of the values of its operands. This occurs as the logical second operand of "&&".

Fixes: c5c1430a1c00ad86855ffff3df3f106bb2bce1d5 ("Catch unsigned integer MGCP parsing errors with strtoul")
Fixes: Coverity CID#202172
FIxes: Coverity CID#202173
Change-Id: Ice9eee6a252fab73dbab5ebf3cfc83c1b354fd08
---
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/mgcp_sdp.c
2 files changed, 2 insertions(+), 2 deletions(-)



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

diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index 910289e..5af441c 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -268,7 +268,7 @@
 {
 	char *pt_str;
 	char *pt_end;
-	unsigned int pt;
+	unsigned long int pt;
 	unsigned int count = 0;
 	unsigned int i;
 
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 56fc611..64d038d 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -132,7 +132,7 @@
 	char *str_ptr;
 	char *pt_str;
 	char *pt_end;
-	unsigned int pt;
+	unsigned long int pt;
 	unsigned int count = 0;
 	unsigned int i;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/14966
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ice9eee6a252fab73dbab5ebf3cfc83c1b354fd08
Gerrit-Change-Number: 14966
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190726/97e4375c/attachment.html>


More information about the gerrit-log mailing list