[MERGED] libosmo-sccp[master]: osmo_sccp_addr_parse() Fix point code integer precision hand...

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 Apr 27 19:50:58 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: osmo_sccp_addr_parse() Fix point code integer precision handling
......................................................................


osmo_sccp_addr_parse() Fix point code integer precision handling

"(cur[1] << 8) & 0x3f" is always 0 regardless of the values of its
operands.

Change-Id: Ie47e632f4bca490baf4282dc5d55ee55ca7f1ae8
Fixes: coverity CID#166932
---
M src/sccp2sua.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/sccp2sua.c b/src/sccp2sua.c
index 7268e27..753d9a4 100644
--- a/src/sccp2sua.c
+++ b/src/sccp2sua.c
@@ -134,7 +134,8 @@
 
 	if (sca->point_code_indicator) {
 		out->presence |= OSMO_SCCP_ADDR_T_PC;
-		out->pc = ((cur[1] << 8) & 0x3f) | cur[0];
+		out->pc = (uint16_t) (cur[1] & 0x3f) << 8;
+		out->pc |= cur[0];
 		cur += 2;
 	}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie47e632f4bca490baf4282dc5d55ee55ca7f1ae8
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list