From 48818821ae5f5ca3f169a448b65ce7a746e961df Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 4 Jan 2022 16:51:25 +0100 Subject: Fix unaligned memory write in FIG0/9 --- src/fig/FIG0_9.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/fig/FIG0_9.cpp') diff --git a/src/fig/FIG0_9.cpp b/src/fig/FIG0_9.cpp index bfa187f..a68dc6f 100644 --- a/src/fig/FIG0_9.cpp +++ b/src/fig/FIG0_9.cpp @@ -183,8 +183,8 @@ FillStatus FIG0_9::fill(uint8_t *buf, size_t max_size) remaining -= 2; for (uint16_t sid : ef.sids) { - uint16_t *sid_field = (uint16_t*)buf; - *sid_field = htons(sid); + const uint16_t sid_field = htons(sid); + memcpy(buf, &sid_field, 2); buf += 2; fig0_9->Length += 2; remaining -= 2; -- cgit v1.2.3