summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-01-04 16:51:25 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-01-04 16:51:25 +0100
commit48818821ae5f5ca3f169a448b65ce7a746e961df (patch)
tree7e7aa490a06ca79524a7daca6e489c51b30a437b
parentc79009cef8db611f410f358a0556ec980db6b5e7 (diff)
downloaddabmux-48818821ae5f5ca3f169a448b65ce7a746e961df.tar.gz
dabmux-48818821ae5f5ca3f169a448b65ce7a746e961df.tar.bz2
dabmux-48818821ae5f5ca3f169a448b65ce7a746e961df.zip
Fix unaligned memory write in FIG0/9
-rw-r--r--src/fig/FIG0_9.cpp4
1 files changed, 2 insertions, 2 deletions
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;