From f57ea92d6e49fb9137615615223da4442643b405 Mon Sep 17 00:00:00 2001 From: Mimi Zohar Date: Fri, 26 Aug 2022 14:36:46 -0400 Subject: [PATCH] Missing template data size lower bounds checking Each record in the IMA measurement list must contain some template data. Ensure the template data is not zero length. Reviewed-by: Petr Vorel Reviewed-by: Stefan Berger Signed-off-by: Mimi Zohar --- src/evmctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/evmctl.c b/src/evmctl.c index ac2e46f..6ab3dd4 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -2189,6 +2189,10 @@ static int ima_measurement(const char *file) log_err("Unable to read template length\n"); goto out; } + if (entry.template_len == 0) { + log_err("Invalid template data len\n"); + goto out; + } } else { entry.template_len = SHA_DIGEST_LENGTH + TCG_EVENT_NAME_LEN_MAX + 1;