NAS message encoding: avoid unaligned access through memcpy()

This commit is contained in:
Robert Schmidt
2024-10-22 11:05:20 +02:00
committed by Laurent THOMAS
parent e94f59edb1
commit 712988d437
@@ -535,7 +535,8 @@ int nas_message_encode(
#endif
emm_security_context);
/* Set the message authentication code of the NAS message */
*(uint32_t*)(buffer + sizeof(uint8_t)) = htonl(mac);
uint32_t mac_nl = htonl(mac);
memcpy(buffer + sizeof(uint8_t), &mac_nl, sizeof(mac_nl));
if (emm_security_context) {
#ifdef NAS_MME