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
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)