Message ID | 20200911195614.429223-1-chpebeni@linux.microsoft.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v2,1/1] libselinux: Fix selabel_lookup() for the root dir. | expand |
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>
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.
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);
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(-)