summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2022-11-17 20:42:06 -0800
committerKees Cook <kees@outflux.net>2023-03-02 11:03:42 -0800
commitf4a3afd78c28dede0907f47951f0b73c9a776d4e (patch)
treee975819aee96d11df531fe22d562de6db59664c6
parent8409bb869a1790f6e02391c3f0eaf9c5fa63e33f (diff)
downloadacpica-f4a3afd78c28dede0907f47951f0b73c9a776d4e.tar.gz
ACPI_PCI_ROUTING_TABLE: Replace fixed-size array with flex array member
The "Source" array is actually a dynamically sized array, but it is defined as a fixed-size 4 byte array. This results in tripping both compile-time and run-time bounds checkers (e.g. via either __builtin_object_size() or -fsanitize=bounds). To retain the padding, create a union with an unused Pad variable of size 4, and redefine Source as a proper flexible array member. No binary changes appear in the .text nor .data sections.
-rw-r--r--source/include/acrestyp.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h
index 252cebc1b..ccde5bdde 100644
--- a/source/include/acrestyp.h
+++ b/source/include/acrestyp.h
@@ -942,8 +942,10 @@ typedef struct acpi_pci_routing_table
UINT32 Pin;
UINT64 Address; /* here for 64-bit alignment */
UINT32 SourceIndex;
- char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
-
+ union {
+ char Pad[4]; /* pad to 64 bits so sizeof() works in all cases */
+ ACPI_FLEX_ARRAY(char, Source);
+ };
} ACPI_PCI_ROUTING_TABLE;
#endif /* __ACRESTYP_H__ */