A struct ends with an array of one element, used as an old form of flexible array

tx0/c:one-element-trailing-arraystrictwarningmaintainability/designdepth fastsmell

What it finds

struct msg { int len; char text[1]; }; allocated with room for more and indexed past the first element: an access beyond the declared length is undefined, and compilers that check bounds or optimize on them break it. A flexible array member, char text[];, says the same in standard C.

From the rule's source, one_element_trailing_array.rs.

Example from the rule's tests
struct message {  int length;  char text[1];tx0 reports: this one-element array at the end of the struct may be used as a flexible array};
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:one-element-trailing-array" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/c:one-element-trailing-array] reason="..."

tx0 explain tx0/c:one-element-trailing-array shows the same in the terminal. Found a false positive? Report it.