Re: [PATCH 1/1] libselinux: Fix selabel_lookup() for the root dir.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 11, 2020 at 3:36 PM Chris PeBenito
<chpebeni@xxxxxxxxxxxxxxxxxxx> wrote:
>
> 9e4480b introduced a change for removing trailing slashes from

For the kernel at least we require the style:
commit <12+ chars of sha1> ("commit subject line")
to ensure that the reference is unambiguous and the reader gets at
least a partial description even without going off to look at it
separately.

> selabel_lookup() for files contexts.  However, it turns the root directory
> lookup "/" into an empty string.
>
> Signed-off-by: Chris PeBenito <chpebeni@xxxxxxxxxxxxxxxxxxx>

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

> ---
>  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
>



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux