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


Change subject: fix misaligned memory write access in 
abis_nm_ipaccess_rsl_connect()
......................................................................

fix misaligned memory write access in abis_nm_ipaccess_rsl_connect()

Use memcpy() to avoid unaligned access, instead of writing through a
pointer cast to uint32_t. Problem spotted by address sanitizer:

abis_nm.c:2802:24: runtime error: store to misaligned address 0x7ffc95396706
for type 'uint32_t', which requires 4 byte alignment
0x7ffc95396706: note: pointer points here
 81 0b bb 80 00 00  00 00 ed 79 28 56 00 00  e0 9c 00 00 a0 61 00 00 ...
             ^
Related: OS#3196

Change-Id: I8e591a56ae522b371da01ea968151a7e6fa24bb9
---
M src/libbsc/abis_nm.c
1 file changed, 1 insertion(+), 1 deletion(-)



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

diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index b2cfa53..ea94d37 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2799,7 +2799,7 @@
        attr[1] = stream;
        attr[3] = port >> 8;
        attr[4] = port & 0xff;
-       *(uint32_t *)(attr+6) = ia.s_addr;
+       memcpy(attr + 6, &ia.s_addr, sizeof(uint32_t));

        /* if ip == 0, we use the default IP */
        if (ip == 0)

--
To view, visit https://gerrit.osmocom.org/9242
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: I8e591a56ae522b371da01ea968151a7e6fa24bb9
Gerrit-Change-Number: 9242
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperl...@sysmocom.de>

Reply via email to