Change in osmo-bsc[master]: fix misaligned memory write access in abis_nm_ipaccess_rsl_connect()

2018-05-24 Thread Stefan Sperling
Stefan Sperling has submitted this change and it was merged. ( 
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(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



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, _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: merged
Gerrit-Change-Id: I8e591a56ae522b371da01ea968151a7e6fa24bb9
Gerrit-Change-Number: 9242
Gerrit-PatchSet: 3
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 


Change in osmo-bsc[master]: fix misaligned memory write access in abis_nm_ipaccess_rsl_connect()

2018-05-22 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/9242 )

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


Patch Set 2: Code-Review+2


--
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: comment
Gerrit-Change-Id: I8e591a56ae522b371da01ea968151a7e6fa24bb9
Gerrit-Change-Number: 9242
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Tue, 22 May 2018 15:23:35 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bsc[master]: fix misaligned memory write access in abis_nm_ipaccess_rsl_connect()

2018-05-22 Thread Stefan Sperling
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, _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