Fix unaligned access to 64 bits payload

This commit is contained in:
Rodrigo Arias 2024-09-06 15:13:58 +02:00
parent e5448af6d8
commit c8b95313ff

View File

@ -363,8 +363,9 @@ print_arg(struct ev_arg *arg, const char *fmt, struct cursor *c, struct emu_ev *
#define CASE(TYPE) \ #define CASE(TYPE) \
do { \ do { \
TYPE *data = (TYPE *) &payload[arg->offset]; \ TYPE data; \
n = snprintf(c->out, (size_t) c->len, fmt, *data); \ memcpy(&data, &payload[arg->offset], sizeof(data)); \
n = snprintf(c->out, (size_t) c->len, fmt, data); \
if (n >= c->len) { \ if (n >= c->len) { \
err("no space for argument"); \ err("no space for argument"); \
return -1; \ return -1; \