[PATCH] expand: fix SIGBUS due to unaligned access
Natanael Copa <[email protected]> Fri, 16 Jan 2026 18:11:21 +0100
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <[email protected]> |
Replace direct uint64_t dereference with memcpy() to avoid SIGBUS on armv7 when p is not 8-byte aligned. Fixes crashes in dash during IFS splitting on strict-alignment architectures. Signed-off-by: Natanael Copa <[email protected]> --- src/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Downstream report: https://gitlab.alpinelinux.org/alpine/aports/-/issues/17896 diff --git a/src/expand.c b/src/expand.c index 8c8bf0e..4ac9d17 100644 --- a/src/expand.c +++ b/src/expand.c @@ -1335,7 +1335,7 @@ ifsbreakup(char *string, int maxargs, struct arglist *arglist) unsigned char b[8]; } x; - x.qw = *(uint64_t *)p; + memcpy(&x.qw, p, sizeof(x.qw)); if ((x.qw & 0x8080808080808080)) break; -- 2.52.0