diff options
-rw-r--r-- | recipes-security/selinux/libselinux/0001-Fix-NULL-pointer-use-in-selinux_restorecon_set_sehandle.patch | 30 | ||||
-rw-r--r-- | recipes-security/selinux/libselinux_3.0.bb | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/recipes-security/selinux/libselinux/0001-Fix-NULL-pointer-use-in-selinux_restorecon_set_sehandle.patch b/recipes-security/selinux/libselinux/0001-Fix-NULL-pointer-use-in-selinux_restorecon_set_sehandle.patch new file mode 100644 index 0000000..8a9fb7c --- /dev/null +++ b/recipes-security/selinux/libselinux/0001-Fix-NULL-pointer-use-in-selinux_restorecon_set_sehandle.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From 08f5e30177218fae7ce9f5c8d6856690126b2b30 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ji Qin <jiqin.ji@huawei.com> | ||
3 | Date: Sun, 14 Jun 2020 21:20:23 -0400 | ||
4 | Subject: [PATCH] libselinux: Fix NULL pointer use in | ||
5 | selinux_restorecon_set_sehandle | ||
6 | |||
7 | error occur when selinux_restorecon_default_handle return NULL in | ||
8 | restorecon_init. | ||
9 | |||
10 | fixes: https://github.com/SELinuxProject/selinux/issues/249 | ||
11 | |||
12 | Signed-off-by: Ji Qin <jiqin.ji@huawei.com> | ||
13 | Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> | ||
14 | --- | ||
15 | libselinux/src/selinux_restorecon.c | 2 ++ | ||
16 | 1 file changed, 2 insertions(+) | ||
17 | |||
18 | diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c | ||
19 | index d1ce830c5..6993be6fd 100644 | ||
20 | --- a/libselinux/src/selinux_restorecon.c | ||
21 | +++ b/libselinux/src/selinux_restorecon.c | ||
22 | @@ -1154,6 +1154,8 @@ void selinux_restorecon_set_sehandle(struct selabel_handle *hndl) | ||
23 | size_t num_specfiles, fc_digest_len; | ||
24 | |||
25 | fc_sehandle = (struct selabel_handle *) hndl; | ||
26 | + if (!fc_sehandle) | ||
27 | + return; | ||
28 | |||
29 | /* Check if digest requested in selabel_open(3), if so use it. */ | ||
30 | if (selabel_digest(fc_sehandle, &fc_digest, &fc_digest_len, | ||
diff --git a/recipes-security/selinux/libselinux_3.0.bb b/recipes-security/selinux/libselinux_3.0.bb index 05d2346..4a60962 100644 --- a/recipes-security/selinux/libselinux_3.0.bb +++ b/recipes-security/selinux/libselinux_3.0.bb | |||
@@ -12,4 +12,5 @@ SRC_URI += "\ | |||
12 | file://libselinux-make-SOCK_CLOEXEC-optional.patch \ | 12 | file://libselinux-make-SOCK_CLOEXEC-optional.patch \ |
13 | file://libselinux-define-FD_CLOEXEC-as-necessary.patch \ | 13 | file://libselinux-define-FD_CLOEXEC-as-necessary.patch \ |
14 | file://0001-Fix-building-against-musl-and-uClibc-libc-libraries.patch \ | 14 | file://0001-Fix-building-against-musl-and-uClibc-libc-libraries.patch \ |
15 | file://0001-Fix-NULL-pointer-use-in-selinux_restorecon_set_sehandle.patch \ | ||
15 | " | 16 | " |