libselinux: Fix selabel_lookup() for the root dir.
PATCH 1/1 libselinux: Fix selabel_lookup() for the root dir.
9e4480b introduced a change for removing trailing slashes from selabel_lookup() for files contexts. However, it turns the root directory lookup "/" into an empty string.
Signed-off-by Chris PeBenito <[email protected]>
--- libselinux/src/label_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/label_file.c +1 -1
@@ -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);
Signature · 1 line
2.26.2
Quoted 2 lines · Chris PeBenito
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.
Quoted 4 lines
selabel_lookup()for files contexts. However, it turns the root directory lookup "/" into an empty string.Signed-off-by Chris PeBenito <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Quoted 20 lines
--- libselinux/src/label_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libselinux/src/label_file.c +1
-2@@ -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