]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: variable sized array cannot be used in ObjectHeader
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 May 2025 17:25:36 +0000 (02:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Jun 2025 04:13:14 +0000 (13:13 +0900)
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

index f3fef931d0371bab3f97fac43a93ddd921c67f05..8cd0843197ef53aab3d4f6240f31a910dfa13bb2 100644 (file)
@@ -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 {                                          \