Change in osmo-pcu[master]: pcu_l1_if: fix misaligned assignment of remote address

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Oct 27 14:43:42 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/20938 )


Change subject: pcu_l1_if: fix misaligned assignment of remote address
......................................................................

pcu_l1_if: fix misaligned assignment of remote address

Found-by: asan
Change-Id: I9c87d3fc1b6f03d79b53f1da3a146630061c3459
---
M src/pcu_l1_if.cpp
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/38/20938/1

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 4491c4e..8a825a1 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -507,7 +507,8 @@
 			local[i].u.sin.sin_port = htons(info_ind->local_port[i]);
 
 			remote[i].u.sin.sin_family = AF_INET;
-			remote[i].u.sin.sin_addr = info_ind->remote_ip[i].v4;
+			memcpy(&remote[i].u.sin.sin_addr, &info_ind->remote_ip[i].v4,
+			       sizeof(struct in_addr));
 			remote[i].u.sin.sin_port = htons(info_ind->remote_port[i]);
 			break;
 		case PCU_IF_ADDR_TYPE_IPV6:
@@ -516,7 +517,9 @@
 			local[i].u.sin6.sin6_port = htons(info_ind->local_port[i]);
 
 			remote[i].u.sin6.sin6_family = AF_INET6;
-			remote[i].u.sin6.sin6_addr = info_ind->remote_ip[i].v6;
+			memcpy(&remote[i].u.sin6.sin6_addr,
+			       &info_ind->remote_ip[i].v6,
+			       sizeof(struct in6_addr));
 			remote[i].u.sin6.sin6_port = htons(info_ind->remote_port[i]);
 			break;
 		default:

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I9c87d3fc1b6f03d79b53f1da3a146630061c3459
Gerrit-Change-Number: 20938
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201027/cfdbe0df/attachment.htm>


More information about the gerrit-log mailing list