Change in osmo-bsc[master]: fix unaligned access in abis_nm_rx_ipacc()

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

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Tue Aug 28 09:53:51 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/10645


Change subject: fix unaligned access in abis_nm_rx_ipacc()
......................................................................

fix unaligned access in abis_nm_rx_ipacc()

Related: OS#3496
Change-Id: Ia9bdce39472719bfebec29e0a55a021ef45c8ea6
---
M src/osmo-bsc/abis_nm.c
1 file changed, 6 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/10645/1

diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 4757c72..93ca33a 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -29,6 +29,7 @@
 #include <libgen.h>
 #include <time.h>
 #include <limits.h>
+#include <inttypes.h>
 
 #include <sys/stat.h>
 #include <netinet/in.h>
@@ -2661,10 +2662,11 @@
 
 			DEBUGPC(DNM, "IP=%s ", inet_ntoa(addr));
 		}
-		if (TLVP_PRESENT(&tp, NM_ATT_IPACC_DST_IP_PORT))
-			DEBUGPC(DNM, "PORT=%u ",
-				ntohs(*((uint16_t *)
-					TLVP_VAL(&tp, NM_ATT_IPACC_DST_IP_PORT))));
+		if (TLVP_PRESENT(&tp, NM_ATT_IPACC_DST_IP_PORT)) {
+			uint16_t port;
+			memcpy(&port, TLVP_VAL(&tp, NM_ATT_IPACC_DST_IP_PORT), sizeof(port));
+			DEBUGPC(DNM, "PORT=%" SCNu16 " ", ntohs(port));
+		}
 		if (TLVP_PRESENT(&tp, NM_ATT_IPACC_STREAM_ID))
 			DEBUGPC(DNM, "STREAM=0x%02x ",
 					*TLVP_VAL(&tp, NM_ATT_IPACC_STREAM_ID));

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9bdce39472719bfebec29e0a55a021ef45c8ea6
Gerrit-Change-Number: 10645
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180828/7a903dad/attachment.htm>


More information about the gerrit-log mailing list