]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:nmbd: fix stringop-overflow warnings
authorStefan Metzmacher <metze@samba.org>
Mon, 30 Mar 2026 15:17:48 +0000 (17:17 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 21 May 2026 17:25:33 +0000 (17:25 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=16006

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/nmbd/nmbd.h

index 0a8e345ddaef27fc3043e0c2eb5cc92487934905..b511777d524cbdc42244b549d0ee4d5dc07c573b 100644 (file)
@@ -209,7 +209,16 @@ struct userdata_struct {
        userdata_copy_fn copy_fn;
        userdata_free_fn free_fn;
        unsigned int userdata_len;
-       char data[16]; /* 16 is to ensure alignment/padding on all systems */
+       /*
+        * The union enforces 16-byte alignment for data[]. Ideally data[]
+        * would be inside the union overlapping __data16, but older GCC
+        * rejects flexible array members in unions. Keeping data[] outside
+        * wastes 16 bytes but preserves the alignment guarantee.
+        */
+       union {
+               char __data16[16] _ALIGNED_(16);
+       };
+       char data[];
 };
 
 struct response_record;