Fix reading of sigfile

This commit is contained in:
shenxiangwei 2023-01-10 15:15:24 +08:00
parent 7a704ebef0
commit 75aa556325
2 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From 210d1e02786302118661b6f4c9969b13112b100c Mon Sep 17 00:00:00 2001
From: Vitaly Chikunov <vt@altlinux.org>
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 <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 d92f2d0..4962040 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -235,7 +235,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.27.0

View File

@ -1,6 +1,6 @@
Name: ima-evm-utils
Version: 1.3.1
Release: 9
Release: 10
Summary: IMA/EVM control utilities
Group: System/Libraries
License: GPLv2
@ -9,7 +9,8 @@ Source0: http://sourceforge.net/projects/linux-ima/files/ima-evm-utils/%{na
Patch9000: add-save-command-and-support-IMA-digest-list.patch
Patch9001: fix-caps-parameter-cannot-be-parsed.patch
Patch9003: skip-test-error-in-docker.patch
Patch9002: skip-test-error-in-docker.patch
Patch9003: backport-ima-evm-utils-Fix-reading-of-sigfile.patch
BuildRequires: autoconf automake libtool m4 asciidoc libxslt openssl-devel
BuildRequires: keyutils-libs-devel git vim-common
@ -82,6 +83,9 @@ make check
%doc %{_mandir}/*/*
%changelog
* Tue Jan 10 2023 shenxiangwei <shenxiangwei1@huawei.com> - 1.3.1-10
- Fix reading of sigfile
* Thu Nov 3 2022 shenxiangwei <shenxiangwei1@huawei.com> - 1.3.1-9
- fix dependency problems