Skip to content

Commit

Permalink
FAPI: Fix length check in auth callback. 4.0.x
Browse files Browse the repository at this point in the history
The max size of the value returned by the auth value
callback sizeof(TPMU_HA) is now checked.

Signed-off-by: Juergen Repp <[email protected]>
  • Loading branch information
JuergenReppSIT authored and AndreasFuchsTPM committed Apr 17, 2024
1 parent bf142e9 commit 5dc26dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tss2-fapi/fapi_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ ifapi_set_auth(
return_if_error(r, "policyAuthCallback");
if (auth != NULL) {
authValue.size = strlen(auth);
if (authValue.size > sizeof(TPMU_HA)) {
return_error2(TSS2_FAPI_RC_BAD_VALUE, "Auth value %u > %lu",
authValue.size, sizeof(TPMU_HA));
}
memcpy(&authValue.buffer[0], auth, authValue.size);
}

Expand Down

0 comments on commit 5dc26dc

Please sign in to comment.