Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guest/generate: fix multiple input/output format specifier argument p…
…arsing Currently, it is ASSUMED but not enforced that the first argument to `secvarctl generate` is a format specifier in the form `a:b`, where a,b correspond to the formats to be generated/converted. This argument parse logic is applied to ANY bare/positional arguments applied to `generate`, including repeated ones. Therefore, any of the following cases can occur: 1. multiple format specifiers can be supplied: `secvarctl generate a:b b:c c:d -n NAME -c file.crt` 2. invalid/erroneous arguments can be mis-interpreted as a format specifier: `secvarctl generate a:b -n NAME -c file.crt -a 0`, where `-a` does not take in an argument, thus yielding "invalid format" 3. format specifiers can be ANYWHERE in the arg list: `secvarctl generate -n NAME -c file.crt a:b` This commit addresses case 1 and 2 by only allowing format specifiers to be declared ONCE in an argument list. Furthermore, the format specifier is validated while parsing, so in the event the erroneous positional argument is read in first, the parser will immediately complain. Case 3 is NOT addressed by this commit, however is a consideration for future refactoring of the argument parsing logic. Signed-off-by: Eric Richter <[email protected]>
- Loading branch information