tpm2_attr_util: tighten token parsing in handle_dispatch to prevent false prefix matches#3557
Conversation
|
@hyperfinitism Thank you for the PRs. I have changed the usage of Also the Arch Linux tests should work. |
|
@hyperfinitism your change would produce a CLI break. ` tpm2_createprimary -c primary.ctx -a "fixedt|fixedparent|sensitivedataorigin|userwithauth|restricted|decrypt" ( |
Prevents false matches like (name = "foo" vs. token = "foobar...") and spurious dispatch_err during table iteration. - Inline token_match() into handle_dispatch() - no-arg tokens require exact strcmp(token, name) match - arg tokens must be in "name=arg" form, which avoid prefix matches - Split token on '=' only after a confirmed match; keep non-matching entries from failing Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
d2b3452 to
b9769c1
Compare
|
Yes, this PR is a breaking change. In the current implementation, If the current behavior (accepting prefix matches) is intended, this PR can be safely closed. |
This PR fixes the token parsing logic in
tpm2_attr_util.cto prevent false matches (e.g.name="foo"vstoken="foobar...") and spuriousdispatch_errreturns during dispatch table iteration.token_match()intohandle_dispatch(). This helper was file-local (no prototype in a public header), so this is not a breaking API change.strcmp(token, name)). The previous implementation could incorrectly accept prefix matches."name=arg"form to avoid prefix matches. The previous implementation could incorrectly accept prefix matches.'='only after a confirmed match so non-matching table entries do not fail parsing.This also silences
discarded-qualifierswarnings/errors (related: #3556).