From 28c4d5b126e336f1632c074fa002969ff42e7a51 Mon Sep 17 00:00:00 2001 Message-ID: <28c4d5b126e336f1632c074fa002969ff42e7a51.1781226895.git.sam@gentoo.org> In-Reply-To: References: From: Herbert Xu Date: Sun, 31 May 2026 13:51:02 +0800 Subject: [PATCH 2/2] builtin: Fix unaligned access in conv_escape When writing out the unicode character in conv_escape, use memcpy instead of direct assignment as the output buffer may not be aligned sufficiently. Reported-by: Nathan Mills Fixes: 776424a8f915 ("parser: Add dollar single quote") Signed-off-by: Herbert Xu --- src/bltin/printf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bltin/printf.c b/src/bltin/printf.c index 671e781..c2c3615 100644 --- a/src/bltin/printf.c +++ b/src/bltin/printf.c @@ -429,7 +429,7 @@ hex: USTPUTC(CTLMBCHAR, out); USTPUTC(len, out); STADJUST(mboff, out); - *(uint32_t *)out = value; + memcpy(out, &value, 4); STADJUST(len, out); USTPUTC(len, out); USTPUTC(CTLMBCHAR, out); -- 2.54.0