Blob Blame History Raw
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