pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/32578 )


Change subject: gprs_sm.c: Fix load of misaligned ptr address
......................................................................

gprs_sm.c: Fix load of misaligned ptr address

Got this Asan runtime error in osmo-sgsn while implementing the MS side of SM:
"""
DMM gprs_sm.c:427 MM(901700000015254/c655d609) -> ACTIVATE PDP CONTEXT REQ: 
SAPI=3 NSAPI=6 IETF IPv4 /osmo-sgsn/src/sgsn/gprs_sm.c:453:16: runtime error: 
load of misaligned address 0x61f000064ba3 for type 'uint32_t', which requires 4 
byte alignment
0x61f000064ba3: note: pointer points here
 00  06 01 21 00 00 00 00 28  09 27 01 00 00 00 00 00  00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00
              ^
"""

Change-Id: I8069e3457120b22bb6514fd5d192bff486d7d87f
---
M src/sgsn/gprs_sm.c
1 file changed, 18 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/78/32578/1

diff --git a/src/sgsn/gprs_sm.c b/src/sgsn/gprs_sm.c
index 1194f31..88d1feb 100644
--- a/src/sgsn/gprs_sm.c
+++ b/src/sgsn/gprs_sm.c
@@ -450,7 +450,7 @@
                DEBUGPC(DMM, "IPv4 ");
                if (req_pdpa_len >= 6) {
                        struct in_addr ia;
-                       ia.s_addr = ntohl(*((uint32_t *) (req_pdpa+2)));
+                       ia.s_addr = osmo_load32be(req_pdpa+2);
                        DEBUGPC(DMM, "%s ", inet_ntop(AF_INET, &ia, buf, 
sizeof(buf)));
                }
                break;

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I8069e3457120b22bb6514fd5d192bff486d7d87f
Gerrit-Change-Number: 32578
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to