aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-05-03 11:35:18 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-05-03 11:35:24 +0200
commit1bebd08a4b2da6d9247a414499aa68b888b052be (patch)
tree6c53e1a850462ada9fd0dd2bf34aec8adec345ab
parenta86056fdf3ba77b9ffd6f6618af59fc3269ee97f (diff)
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
-rw-r--r--src/sgsn/gprs_sm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sgsn/gprs_sm.c b/src/sgsn/gprs_sm.c
index 1194f31a7..88d1feb5a 100644
--- a/src/sgsn/gprs_sm.c
+++ b/src/sgsn/gprs_sm.c
@@ -450,7 +450,7 @@ static int do_act_pdp_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, bool *del
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;