Linux Integrity Measurement development
 help / color / mirror / Atom feed
* [PATCH 1/2] ima-evm-utils: Fix reading of sigfile
@ 2020-09-12 19:36 Vitaly Chikunov
  2020-09-12 19:36 ` [PATCH 2/2] ima-evm-utils: Add test for sigfile reading Vitaly Chikunov
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Chikunov @ 2020-09-12 19:36 UTC (permalink / raw)
  To: Mimi Zohar, Dmitry Kasatkin, linux-integrity; +Cc: Mimi Zohar

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 <zohar@linux.ibm.com>
Fixes: 08a51e7460fd ("ima-evm-utils: Fix file2bin stat and fopen relations")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
 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);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-14  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-12 19:36 [PATCH 1/2] ima-evm-utils: Fix reading of sigfile Vitaly Chikunov
2020-09-12 19:36 ` [PATCH 2/2] ima-evm-utils: Add test for sigfile reading Vitaly Chikunov
2020-09-14  0:30   ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox