Ghidra flexible arrays support what you are trying to do. From Ghidra help (search for "flexible array"):
A flexible array is added to the end of a structure by adding a last row specified by the base DataType (e.g. char) then invoking the array action and specifying an element count of 0.
So you can't create a flexible array in 1 step. Enter the data type for the variable-length structure member first. Then select the row for that new structure member and press the [
key to invoke the array action. Entering 0 as the element count in the resulting dialog will create a flexible array.
Ghidra flexible arrays have limited functionality. From Ghidra help:
The use of flexible array components is not currently reflected in decompiler results or listing reference markup. Its primary purpose if to reflect the C/C++ source definition of a structure with correct alignment and structure sizing.
While C/C++ support flexible arrays anywhere within a structure, Ghidra only supports the case where it is the last structure component.
type[0]
? For some reason, Ghidra doesn't allow me to do that.