chantra / rpms / tpm2-tools

Forked from rpms/tpm2-tools 2 years ago
Clone

Blame SOURCES/0003-tpm2_options-fix-possible-null-ptr-passed-to-strdup.patch

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