From 232836a079cc2f5bc744371500963b61ab0f9e2a Mon Sep 17 00:00:00 2001 From: Mimi Zohar Date: Fri, 26 Aug 2022 14:25:56 -0400 Subject: [PATCH] Limit the file hash algorithm name length Instead of assuming the file hash algorithm is a properly NULL terminated string, properly limit the "algo:" field size. Reviewed-by: Petr Vorel Reviewed-by: Stefan Berger Signed-off-by: Mimi Zohar --- src/evmctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evmctl.c b/src/evmctl.c index b8ba339..ac2e46f 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -1603,7 +1603,7 @@ void ima_ng_show(struct template_entry *entry) total_len -= sizeof(field_len); algo = (char *)fieldp; - len = strlen(algo) + 1; + len = strnlen(algo, field_len - 1) + 1; digest_len = field_len - len; digest = fieldp + len;