summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tpm-common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/tpm-common.c b/lib/tpm-common.c
index 4277846fdd..82ffdc5341 100644
--- a/lib/tpm-common.c
+++ b/lib/tpm-common.c
@@ -176,6 +176,11 @@ u32 tpm_sendrecv_command(struct udevice *dev, const void *command,
}
size = tpm_command_size(command);
+
+ /* sanity check, which also helps coverity */
+ if (size > COMMAND_BUFFER_SIZE)
+ return log_msg_ret("size", -E2BIG);
+
log_debug("TPM request [size:%d]: ", size);
for (i = 0; i < size; i++)
log_debug("%02x ", ((u8 *)command)[i]);