1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-27 14:22:31 +02:00

Limit the file hash algorithm name length

Instead of assuming the file hash algorithm is a properly NULL terminated
string, properly limit the "algo:<hash>" field size.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Mimi Zohar 2022-08-26 14:25:56 -04:00
parent f2b1b66b7c
commit 232836a079

View File

@ -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;