From f27e2f7d99354d3962331f6dc9504dcafd4eca3d Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Sat, 12 Sep 2020 22:36:13 +0300 Subject: [PATCH] ima-evm-utils: Fix reading of sigfile Fix reading of detached IMA signature (--sigfile). Error message: Reading to sha1.txt.sig Failed to fread 147 bytes: sha1.txt.sig Failed reading: sha1.txt Reported-by: Mimi Zohar Fixes: 08a51e7460fd ("ima-evm-utils: Fix file2bin stat and fopen relations") Signed-off-by: Vitaly Chikunov Reviewed-by: Lakshmi Ramasubramanian Signed-off-by: Mimi Zohar (cherry picked from commit 19b77c866738ca0718232348edf56259071db7cf) --- src/evmctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evmctl.c b/src/evmctl.c index 7ad1150..2359550 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -221,7 +221,7 @@ static unsigned char *file2bin(const char *file, const char *ext, int *size) fclose(fp); return NULL; } - if (fread(data, len, 1, fp) != len) { + if (fread(data, len, 1, fp) != 1) { log_err("Failed to fread %zu bytes: %s\n", len, name); fclose(fp); free(data);