tpm2-tools/0003-tpm2_options-fix-possible-null-ptr-passed-to-strdup.patch
Štěpán Horáček d8b5733ac7 tpm2-tools: Fix segfault and add support for OpenSSL 3
The segfault was caused by calling tpm2 command on ppc64le without any
additional arguments.

Resolves: rhbz#1989617

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
2021-10-05 12:20:18 +02:00

32 lines
924 B
Diff

From 2a064f4c91a90ab95fe354a42e1166a4c64452fb Mon Sep 17 00:00:00 2001
From: William Roberts <william.c.roberts@intel.com>
Date: Wed, 25 Nov 2020 07:48:44 -0600
Subject: [PATCH 02/17] tpm2_options: fix possible null ptr passed to strdup
Fixes:
../lib/tpm2_options.c:201:20: warning: Null pointer passed as an argument to a 'nonnull' parameter
command_copy = strdup(command);
Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
lib/tpm2_options.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/tpm2_options.c b/lib/tpm2_options.c
index 9fa583c6..c2e18bad 100644
--- a/lib/tpm2_options.c
+++ b/lib/tpm2_options.c
@@ -193,8 +193,7 @@ void tpm2_print_usage(const char *command, struct tpm2_options *tool_opts) {
unsigned int i;
bool indent = true;
char *command_copy;
-
- if (!tool_opts) {
+ if (!tool_opts || !command) {
return;
}
--
2.31.1