2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

chfa: get not-flextable size and padding correct

The kernel does not expect a name and it is not used even within the
parser so drop it. Correct the padding calculation.

  sizeof(th_version)

includes the trailing \0 in the count so we should not be adding it
explicitly. Doing so made it seem like we were writing an extra byte
and messing things up, because the string write below did not include
the \0 which we had to add explicitly.

Switch to writing the th_version using size_of() bytes as is used in
the pad calculation, to avoid confusion around the header padding.

Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen
2024-07-18 06:29:44 -07:00
parent 42523bae91
commit 792f23c878
3 changed files with 7 additions and 6 deletions

View File

@@ -307,7 +307,7 @@ void *aare_rules::create_dfa(size_t *size, int *min_match_len, optflags const &o
CHFA chfa(dfa, eq, opts);
if (opts.dump & DUMP_DFA_TRANS_TABLE)
chfa.dump(cerr);
chfa.flex_table(stream, "");
chfa.flex_table(stream);
}
catch(int error) {
*size = 0;