The previous fix didn't actually do anything but print a warning. Actually fix the issue this time. Resolves: RHEL-28768 CVE CVE-2024-2314 Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
34 lines
1.3 KiB
Diff
34 lines
1.3 KiB
Diff
From 509b05f2790fd1f9e725e353521a5a555ca57aaf Mon Sep 17 00:00:00 2001
|
|
From: Chunsheng Luo <48231204+luochenglcs@users.noreply.github.com>
|
|
Date: Mon, 18 Mar 2024 00:09:21 +0800
|
|
Subject: [PATCH] clang: Fix file_exists_and_ownedby return value (#4935)
|
|
|
|
commit 008ea09 (clang: check header ownership) updates file_exists()
|
|
to file_exists_and_ownedby(), add verifies onwer, but the return value
|
|
is different from before, causing problems with the original code.
|
|
|
|
Signed-off-by: Chunsheng Luo <luochunsheng@ustc.edu>
|
|
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
|
---
|
|
src/cc/frontends/clang/kbuild_helper.cc | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
|
|
index 1b291469..0387f872 100644
|
|
--- a/src/cc/frontends/clang/kbuild_helper.cc
|
|
+++ b/src/cc/frontends/clang/kbuild_helper.cc
|
|
@@ -143,8 +143,8 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
|
|
static inline int file_exists_and_ownedby(const char *f, uid_t uid)
|
|
{
|
|
struct stat buffer;
|
|
- int ret;
|
|
- if ((ret = stat(f, &buffer)) == 0) {
|
|
+ int ret = stat(f, &buffer) == 0;
|
|
+ if (ret) {
|
|
if (buffer.st_uid != uid) {
|
|
std::cout << "ERROR: header file ownership unexpected: " << std::string(f) << "\n";
|
|
return -1;
|
|
--
|
|
2.44.0
|
|
|