All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] libselinux: Fix selabel_lookup() for the root dir.
@ 2020-09-11 19:56 Chris PeBenito
  2020-09-11 20:18 ` Stephen Smalley
  0 siblings, 1 reply; 3+ messages in thread
From: Chris PeBenito @ 2020-09-11 19:56 UTC (permalink / raw)
  To: selinux

9e4480b921bb ("Remove trailing slash on selabel_file lookups.") introduced
a bug which turns the root directory lookup "/" into an empty string.

v2: Fix commit message

Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.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 6eeeea68..726394ca 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.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] libselinux: Fix selabel_lookup() for the root dir.
  2020-09-11 19:56 [PATCH v2 1/1] libselinux: Fix selabel_lookup() for the root dir Chris PeBenito
@ 2020-09-11 20:18 ` Stephen Smalley
  2020-09-15 13:23   ` Stephen Smalley
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Smalley @ 2020-09-11 20:18 UTC (permalink / raw)
  To: Chris PeBenito; +Cc: SElinux list

On Fri, Sep 11, 2020 at 3:57 PM Chris PeBenito
<chpebeni@linux.microsoft.com> wrote:
>
> 9e4480b921bb ("Remove trailing slash on selabel_file lookups.") introduced
> a bug which turns the root directory lookup "/" into an empty string.

Thanks.

> v2: Fix commit message

This should go after the --- so that it doesn't get included in the
commit message since only the final version gets committed.  But don't
worry about re-posting just for that; I can just amend it before
merging if I remember or if not no big deal.

> Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>

Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] libselinux: Fix selabel_lookup() for the root dir.
  2020-09-11 20:18 ` Stephen Smalley
@ 2020-09-15 13:23   ` Stephen Smalley
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2020-09-15 13:23 UTC (permalink / raw)
  To: Chris PeBenito; +Cc: SElinux list

On Fri, Sep 11, 2020 at 4:18 PM Stephen Smalley
<stephen.smalley.work@gmail.com> wrote:
>
> On Fri, Sep 11, 2020 at 3:57 PM Chris PeBenito
> <chpebeni@linux.microsoft.com> wrote:
> >
> > 9e4480b921bb ("Remove trailing slash on selabel_file lookups.") introduced
> > a bug which turns the root directory lookup "/" into an empty string.
>
> Thanks.
>
> > v2: Fix commit message
>
> This should go after the --- so that it doesn't get included in the
> commit message since only the final version gets committed.  But don't
> worry about re-posting just for that; I can just amend it before
> merging if I remember or if not no big deal.
>
> > Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-16  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 19:56 [PATCH v2 1/1] libselinux: Fix selabel_lookup() for the root dir Chris PeBenito
2020-09-11 20:18 ` Stephen Smalley
2020-09-15 13:23   ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.