74de835e2c
- Use libsepol.so.2 - Convert matchpathcon to selabel_lookup() - Change userspace AVC setenforce and policy load messages to audit format - Remove trailing slash on selabel_file lookups - Use kernel status page by default
31 lines
1.0 KiB
Diff
31 lines
1.0 KiB
Diff
From 075f9cfe7a0105e14e878b5617e80d391d016e08 Mon Sep 17 00:00:00 2001
|
|
From: Chris PeBenito <chpebeni@linux.microsoft.com>
|
|
Date: Fri, 11 Sep 2020 15:56:14 -0400
|
|
Subject: [PATCH] libselinux: Fix selabel_lookup() for the root dir.
|
|
|
|
9e4480b921bb ("Remove trailing slash on selabel_file lookups.") introduced
|
|
a bug which turns the root directory lookup "/" into an empty string.
|
|
|
|
Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
|
|
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
|
|
---
|
|
libselinux/src/label_file.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
|
|
index 6eeeea68aea4..726394ca4332 100644
|
|
--- a/libselinux/src/label_file.c
|
|
+++ b/libselinux/src/label_file.c
|
|
@@ -902,7 +902,7 @@ static const struct spec **lookup_all(struct selabel_handle *rec,
|
|
goto finish;
|
|
}
|
|
|
|
- if (key[len - 1] == '/') {
|
|
+ if (len > 1 && key[len - 1] == '/') {
|
|
/* reuse clean_key from above if available */
|
|
if (!clean_key) {
|
|
clean_key = (char *) malloc(len);
|
|
--
|
|
2.29.0
|
|
|