|
|
6a14f3 |
From f140a8e5fdb2f3b9fbc3b32d1a844554008c2298 Mon Sep 17 00:00:00 2001
|
|
|
6a14f3 |
From: William Roberts <william.c.roberts@intel.com>
|
|
|
6a14f3 |
Date: Fri, 3 Jun 2022 11:51:02 -0500
|
|
|
6a14f3 |
Subject: [PATCH 20/23] esys_iutil: fix possible NPD
|
|
|
6a14f3 |
|
|
|
6a14f3 |
Clang-10 scan-build reports:
|
|
|
6a14f3 |
src/tss2-esys/esys_iutil.c:1366:56: warning: Dereference of null pointer
|
|
|
6a14f3 |
auths->auths[auths->count].sessionHandle = session->rsrc.handle;
|
|
|
6a14f3 |
^~~~~~~~~~~~~~~~~~~~
|
|
|
6a14f3 |
1 warning generated.
|
|
|
6a14f3 |
|
|
|
6a14f3 |
The code above the report checks that session might be NULL:
|
|
|
6a14f3 |
RSRC_NODE_T *session = esys_context->session_tab[session_idx];
|
|
|
6a14f3 |
if (session != NULL) {
|
|
|
6a14f3 |
IESYS_SESSION *rsrc_session = &session->rsrc.misc.rsrc_session;
|
|
|
6a14f3 |
if (rsrc_session->type_policy_session == POLICY_PASSWORD) {
|
|
|
6a14f3 |
|
|
|
6a14f3 |
Thus suggesting/indicating session may be NULL in subsequent code where
|
|
|
6a14f3 |
session is dereferenced.
|
|
|
6a14f3 |
|
|
|
6a14f3 |
Signed-off-by: William Roberts <william.c.roberts@intel.com>
|
|
|
6a14f3 |
---
|
|
|
6a14f3 |
src/tss2-esys/esys_iutil.c | 2 +-
|
|
|
6a14f3 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
6a14f3 |
|
|
|
6a14f3 |
diff --git a/src/tss2-esys/esys_iutil.c b/src/tss2-esys/esys_iutil.c
|
|
|
6a14f3 |
index 0cc92ca5..493f9b28 100644
|
|
|
6a14f3 |
--- a/src/tss2-esys/esys_iutil.c
|
|
|
6a14f3 |
+++ b/src/tss2-esys/esys_iutil.c
|
|
|
6a14f3 |
@@ -1339,7 +1339,7 @@ iesys_gen_auths(ESYS_CONTEXT * esys_context,
|
|
|
6a14f3 |
&& encryptNonceIdx > 0) ? encryptNonce : NULL,
|
|
|
6a14f3 |
&auths->auths[session_idx]);
|
|
|
6a14f3 |
return_if_error(r, "Error while computing hmacs");
|
|
|
6a14f3 |
- if (esys_context->session_tab[session_idx] != NULL) {
|
|
|
6a14f3 |
+ if (esys_context->session_tab[session_idx] != NULL && session != NULL) {
|
|
|
6a14f3 |
auths->auths[auths->count].sessionHandle = session->rsrc.handle;
|
|
|
6a14f3 |
auths->count++;
|
|
|
6a14f3 |
}
|
|
|
6a14f3 |
--
|
|
|
6a14f3 |
2.34.3
|
|
|
6a14f3 |
|