1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-07-03 22:23:16 +02:00

1 Commits

Author SHA1 Message Date
f27e2f7d99 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 <zohar@linux.ibm.com>
Fixes: 08a51e7460 ("ima-evm-utils: Fix file2bin stat and fopen relations")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
(cherry picked from commit 19b77c8667)
2020-10-23 13:59:07 -04:00

View File

@ -221,7 +221,7 @@ static unsigned char *file2bin(const char *file, const char *ext, int *size)
fclose(fp); fclose(fp);
return NULL; 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); log_err("Failed to fread %zu bytes: %s\n", len, name);
fclose(fp); fclose(fp);
free(data); free(data);