代码拉取完成,页面将自动刷新
From 7bf818c8344ecbf0e14a26e6393582ae79df864e Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 30 Jan 2024 15:04:03 +0200
Subject: [PATCH] Tip-toe around rpmfiFN() thin ice in fsm
Any pointer gotten from rpmfiFN() is only valid until the next
rpmfiFN() call, and here the path can end up inside plugins which
may have their own reasons for calling rpmfiFN(). At which point
the dest we passed would be invalid. strdup() it to appease ASAN,
but this needs a saner solution really.
---
lib/fsm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/fsm.c b/lib/fsm.c
index a54e43bae..36708acc3 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -736,7 +736,7 @@ static int fsmSetmeta(int fd, int dirfd, const char *path,
int nofcaps)
{
int rc = 0;
- const char *dest = rpmfiFN(fi);
+ char *dest = xstrdup(rpmfiFN(fi));
if (!rc && !getuid()) {
rc = fsmChown(fd, dirfd, path, st->st_mode, st->st_uid, st->st_gid);
@@ -756,6 +756,7 @@ static int fsmSetmeta(int fd, int dirfd, const char *path,
fd, path, dest,
st->st_mode, action);
}
+ free(dest);
return rc;
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。