tpm2: ExecuteCommand: Handle unreasonably large command sizes

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2023-08-23 20:51:52 -04:00 committed by Stefan Berger
parent 4bee97102b
commit c235a90932

View File

@ -111,6 +111,12 @@ ExecuteCommand(
// Response local variables
UINT32 maxResponse = *responseSize;
TPM_RC result; // return code for the command
/* check for an unreasonably large command size, since it's cast to a signed integer later */
if (requestSize > INT32_MAX) {
result = TPM_RC_SUCCESS;
goto Cleanup;
}
// This next function call is used in development to size the command and response
// buffers. The values printed are the sizes of the internal structures and
// not the sizes of the canonical forms of he command response structures. Also,