2023-07-28 15:36:40 +08:00
|
|
|
From 24c9623f563646695f6d219b2414b23f36378b42 Mon Sep 17 00:00:00 2001
|
2022-08-19 15:02:50 +08:00
|
|
|
From: shenxiangwei <shenxiangwei1@huawei.com>
|
|
|
|
|
Date: Fri, 19 Aug 2022 12:05:11 +0800
|
|
|
|
|
Subject: [PATCH] fix caps parameter cannot be parsed
|
|
|
|
|
|
|
|
|
|
Signed-off-by: shenxiangwei <shenxiangwei1@huawei.com>
|
2023-07-28 15:36:40 +08:00
|
|
|
Signed-off-by: zhoushuiqing <zhoushuiqing2@huawei.com>
|
2022-08-19 15:02:50 +08:00
|
|
|
---
|
|
|
|
|
src/evmctl.c | 4 ++--
|
|
|
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/src/evmctl.c b/src/evmctl.c
|
2023-07-28 15:36:40 +08:00
|
|
|
index 70d07a5..19175b8 100644
|
2022-08-19 15:02:50 +08:00
|
|
|
--- a/src/evmctl.c
|
|
|
|
|
+++ b/src/evmctl.c
|
2023-07-28 15:36:40 +08:00
|
|
|
@@ -472,14 +472,14 @@ static int calc_evm_hash(const char *file, unsigned char *hash)
|
2022-08-19 15:02:50 +08:00
|
|
|
} else if (!strcmp(*xattrname, XATTR_NAME_CAPS) && (hmac_flags & HMAC_FLAG_CAPS_SET)) {
|
|
|
|
|
if (!caps_str)
|
|
|
|
|
continue;
|
|
|
|
|
- err = strlen(caps_str);
|
|
|
|
|
+ hex2bin(xattr_value, caps_str, strlen(caps_str) >> 1);
|
|
|
|
|
+ err = strlen(caps_str) >> 1;
|
|
|
|
|
if (err >= sizeof(xattr_value)) {
|
|
|
|
|
log_err("caps[%u] value is too long to fit into xattr[%zu]\n",
|
|
|
|
|
err + 1, sizeof(xattr_value));
|
2023-07-28 15:36:40 +08:00
|
|
|
err = -1;
|
|
|
|
|
goto out;
|
2022-08-19 15:02:50 +08:00
|
|
|
}
|
|
|
|
|
- strcpy(xattr_value, caps_str);
|
|
|
|
|
} else {
|
|
|
|
|
err = lgetxattr(file, *xattrname, xattr_value, sizeof(xattr_value));
|
|
|
|
|
if (err < 0) {
|
|
|
|
|
--
|
2023-07-28 15:36:40 +08:00
|
|
|
2.33.0
|
2022-08-19 15:02:50 +08:00
|
|
|
|