From 11a2f1ed91d5bce48fa0b9ea5d80c80361c6d8c0 Mon Sep 17 00:00:00 2001 From: Tino Reichardt Date: Mon, 22 Jul 2024 08:48:23 +0200 Subject: [PATCH] Handle current UBSAN errors on Fedora The fixed size array sa_lengths[1] is used dynamicly and UBSAN warns about it: [ 1110.124477] ------------[ cut here ]------------ [ 1110.126140] UBSAN: array-index-out-of-bounds in .../sa.c:766:21 [ 1110.130745] index 1 is out of range for type 'uint16_t [1]' [ 1110.406282] UBSAN: array-index-out-of-bounds in .../sa.c:1934:29 [ 1110.411905] index 1 is out of range for type 'uint16_t [1]' [ 1110.817251] UBSAN: array-index-out-of-bounds in .../sa.c:1734:24 [ 1110.821635] index 1 is out of range for type 'uint16_t [1]' Fix the header file and make sa_lengths variable: sa_lengths[1] -> sa_lengths[] Signed-off-by: Tino Reichardt --- include/sys/sa_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sys/sa_impl.h b/include/sys/sa_impl.h index 744c8dcb7d..fab7cd9e7e 100644 --- a/include/sys/sa_impl.h +++ b/include/sys/sa_impl.h @@ -177,7 +177,7 @@ typedef struct sa_hdr_phys { * */ uint16_t sa_layout_info; - uint16_t sa_lengths[1]; /* optional sizes for variable length attrs */ + uint16_t sa_lengths[]; /* optional sizes for variable length attrs */ /* ... Data follows the lengths. */ } sa_hdr_phys_t;