Skip to content

Commit fc08eac

Browse files
committed
tpm: fix scan-build not null argument
1 parent 30ed1fa commit fc08eac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tpm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,15 @@ int wolfBoot_seal_auth(const uint8_t* pubkey_hint,
851851
WOLFTPM2_KEYBLOB seal_blob;
852852
word32 nvAttributes;
853853

854+
if (auth == NULL && authSz > 0)
855+
return BAD_FUNC_ARG;
856+
854857
memset(&seal_blob, 0, sizeof(seal_blob));
855858

856859
seal_blob.handle.auth.size = authSz;
857-
XMEMCPY(seal_blob.handle.auth.buffer, auth, authSz);
860+
861+
if (auth != NULL)
862+
XMEMCPY(seal_blob.handle.auth.buffer, auth, authSz);
858863

859864
/* creates a sealed keyed hash object (not loaded to TPM) */
860865
rc = wolfBoot_seal_blob(pubkey_hint, policy, policySz, &seal_blob,

0 commit comments

Comments
 (0)