mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-24 03:35:38 +03:00
35 lines
1.7 KiB
Diff
35 lines
1.7 KiB
Diff
just running tpm2 will segfault without this patch.
|
|
In upstream master branch, but not yet in a release, see https://github.com/tpm2-software/tpm2-tools/commit/fb1e0d98eca5279bf33304deedd9019b0130393a
|
|
Can probably be removed after 5.0.1 is released.
|
|
|
|
index e9aaa036..9fa583c6 100644
|
|
--- a/lib/tpm2_options.c
|
|
+++ b/lib/tpm2_options.c
|
|
@@ -300,7 +300,7 @@ tpm2_option_code tpm2_handle_options(int argc, char **argv,
|
|
if (argv[optind - 1]) {
|
|
if (!strcmp(argv[optind - 1], "--help=no-man") ||
|
|
!strcmp(argv[optind - 1], "-h=no-man") ||
|
|
- (argv[optind] && !strcmp(argv[optind], "no-man"))) {
|
|
+ (argc < optind && !strcmp(argv[optind], "no-man"))) {
|
|
manpager = false;
|
|
optind++;
|
|
/*
|
|
@@ -309,7 +309,7 @@ tpm2_option_code tpm2_handle_options(int argc, char **argv,
|
|
*/
|
|
} else if (!strcmp(argv[optind - 1], "--help=man") ||
|
|
!strcmp(argv[optind - 1], "-h=man") ||
|
|
- (argv[optind] && !strcmp(argv[optind], "man"))) {
|
|
+ (argc < optind && !strcmp(argv[optind], "man"))) {
|
|
manpager = true;
|
|
explicit_manpager = true;
|
|
optind++;
|
|
@@ -318,7 +318,7 @@ tpm2_option_code tpm2_handle_options(int argc, char **argv,
|
|
* argv[0] = "tool name"
|
|
* argv[1] = "--help" argv[2] = 0
|
|
*/
|
|
- if (!argv[optind] && argc == 2) {
|
|
+ if (optind >= argc && argc == 2) {
|
|
manpager = false;
|
|
} else {
|
|
/*
|
|
|