diff options
author | Pedro Falcato <pedro.falcato@gmail.com> | 2023-02-18 23:22:38 +0000 |
---|---|---|
committer | Travis Geiselbrecht <travisg@gmail.com> | 2023-02-18 16:47:16 -0800 |
commit | bf2e94c2f8ede8b409f9c5836c04de6efbface34 (patch) | |
tree | 6c3948d691cfab2c866b2ffcc1a42e25a760f73d | |
parent | 81d6014493a3fe9f6f2bee3f8a316a95f83ee3dd (diff) | |
download | lk-bf2e94c2f8ede8b409f9c5836c04de6efbface34.tar.gz |
[minip] Fix undefined behavior in mac_addr_copy
There was a possibly unaligned store in mac_addr_copy.
Replace it with a memcpy call that should generate equivalent,
well defined code.
-rw-r--r-- | lib/minip/minip-internal.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/minip/minip-internal.h b/lib/minip/minip-internal.h index 827633fa..6d3761c2 100644 --- a/lib/minip/minip-internal.h +++ b/lib/minip/minip-internal.h @@ -141,6 +141,5 @@ bool net_timer_cancel(net_timer_t *) __NONNULL(); void net_timer_init(void); static inline void mac_addr_copy(uint8_t *dest, const uint8_t *src) { - *(uint32_t *)dest = *(const uint32_t *)src; - *(uint16_t *)(dest + 4) = *(const uint16_t *)(src + 4); + memcpy(dest, src, 6); } |