summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-09-01 08:50:35 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-09-01 08:55:54 +0300
commit004ec5adc7e5702c518583caef437d304932beb5 (patch)
tree68517316725b0fcad7fe302f6ace4ccee9ed682e /accel-pppd/ppp
parentcbbae583e584f83957acd99440fc67343d46b800 (diff)
downloadaccel-ppp-004ec5adc7e5702c518583caef437d304932beb5.tar.gz
accel-ppp-004ec5adc7e5702c518583caef437d304932beb5.zip
ipv6: avoid integer access through address bytes
Copy interface IDs and prefix words between aligned temporaries and byte arrays instead of casting IPv6 address storage to uint64_t pointers.
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r--accel-pppd/ppp/ipv6cp_opt_intfid.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/accel-pppd/ppp/ipv6cp_opt_intfid.c b/accel-pppd/ppp/ipv6cp_opt_intfid.c
index cb33f024..5de88932 100644
--- a/accel-pppd/ppp/ipv6cp_opt_intfid.c
+++ b/accel-pppd/ppp/ipv6cp_opt_intfid.c
@@ -284,12 +284,14 @@ static void ipaddr_print(void (*print)(const char *fmt,...), struct ipv6cp_optio
{
struct ipaddr_option_t *ipaddr_opt = container_of(opt, typeof(*ipaddr_opt), opt);
struct ipv6cp_opt64_t *opt64 = (struct ipv6cp_opt64_t *)ptr;
- struct in6_addr a;
+ struct in6_addr a = {};
+ uint64_t intf_id;
if (ptr)
- *(uint64_t *)(a.s6_addr + 8) = opt64->val;
+ intf_id = opt64->val;
else
- *(uint64_t *)(a.s6_addr + 8) = ipaddr_opt->ppp->ses.ipv6->intf_id;
+ intf_id = ipaddr_opt->ppp->ses.ipv6->intf_id;
+ memcpy(a.s6_addr + 8, &intf_id, sizeof(intf_id));
print("<addr %x:%x:%x:%x>", ntohs(a.s6_addr16[4]), ntohs(a.s6_addr16[5]), ntohs(a.s6_addr16[6]), ntohs(a.s6_addr16[7]));
}
@@ -376,4 +378,3 @@ static void init()
}
DEFINE_INIT(5, init);
-