From c8b95313ffe64bcd6cb4de7ad286d2af083d055e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 6 Sep 2024 15:13:58 +0200 Subject: [PATCH] Fix unaligned access to 64 bits payload --- src/emu/ev_spec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emu/ev_spec.c b/src/emu/ev_spec.c index adf49c2..83225ef 100644 --- a/src/emu/ev_spec.c +++ b/src/emu/ev_spec.c @@ -363,8 +363,9 @@ print_arg(struct ev_arg *arg, const char *fmt, struct cursor *c, struct emu_ev * #define CASE(TYPE) \ do { \ - TYPE *data = (TYPE *) &payload[arg->offset]; \ - n = snprintf(c->out, (size_t) c->len, fmt, *data); \ + TYPE data; \ + memcpy(&data, &payload[arg->offset], sizeof(data)); \ + n = snprintf(c->out, (size_t) c->len, fmt, data); \ if (n >= c->len) { \ err("no space for argument"); \ return -1; \