From 462d287bc9edc395d65503ee0ce24277304ef932 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 17 May 2025 02:25:36 +0900 Subject: [PATCH] sd-journal: variable sized array cannot be used in ObjectHeader The struct ObjectHeader is embedded in real object structs. Hence, the existence of the flex array in ObjectHeader violates the requirement that flex array must be at the end of struct. --- src/libsystemd/sd-journal/journal-def.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libsystemd/sd-journal/journal-def.h b/src/libsystemd/sd-journal/journal-def.h index f3fef931d0..8cd0843197 100644 --- a/src/libsystemd/sd-journal/journal-def.h +++ b/src/libsystemd/sd-journal/journal-def.h @@ -55,7 +55,8 @@ struct ObjectHeader { uint8_t flags; uint8_t reserved[6]; le64_t size; - uint8_t payload[]; + uint8_t payload[0]; /* The struct is embedded in other objects, hence flex array (i.e. payload[]) + * cannot be used. */ } _packed_; #define DataObject__contents { \