SELinux Security Module development
 help / color / mirror / Atom feed
* [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle
@ 2020-06-15  1:20 Ji Qin
  2020-06-15 11:39 ` Stephen Smalley
  0 siblings, 1 reply; 3+ messages in thread
From: Ji Qin @ 2020-06-15  1:20 UTC (permalink / raw)
  To: selinux; +Cc: jiqin.ji

error occur when selinux_restorecon_default_handle return NULL in
restorecon_init.

fixes: https://github.com/SELinuxProject/selinux/issues/249

Signed-off-by: Ji Qin <jiqin.ji@huawei.com>
---
 libselinux/src/selinux_restorecon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
index 91dfeb66..c2d05a66 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -1153,6 +1153,8 @@ void selinux_restorecon_set_sehandle(struct selabel_handle *hndl)
 	size_t num_specfiles, fc_digest_len;
 
 	fc_sehandle = (struct selabel_handle *) hndl;
+	if (!fc_sehandle)
+		return;
 
 	/* Check if digest requested in selabel_open(3), if so use it. */
 	if (selabel_digest(fc_sehandle, &fc_digest, &fc_digest_len,
-- 
2.23.0


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

* Re: [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle
  2020-06-15  1:20 [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle Ji Qin
@ 2020-06-15 11:39 ` Stephen Smalley
  2020-06-18 19:33   ` Petr Lautrbach
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Smalley @ 2020-06-15 11:39 UTC (permalink / raw)
  To: Ji Qin; +Cc: SElinux list

On Sun, Jun 14, 2020 at 9:22 PM Ji Qin <jiqin.ji@huawei.com> wrote:
>
> error occur when selinux_restorecon_default_handle return NULL in
> restorecon_init.
>
> fixes: https://github.com/SELinuxProject/selinux/issues/249
>
> Signed-off-by: Ji Qin <jiqin.ji@huawei.com>

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

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

* Re: [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle
  2020-06-15 11:39 ` Stephen Smalley
@ 2020-06-18 19:33   ` Petr Lautrbach
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Lautrbach @ 2020-06-18 19:33 UTC (permalink / raw)
  To: SElinux list; +Cc: Ji Qin, Stephen Smalley

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

On Mon, Jun 15, 2020 at 07:39:23AM -0400, Stephen Smalley wrote:
> On Sun, Jun 14, 2020 at 9:22 PM Ji Qin <jiqin.ji@huawei.com> wrote:
> >
> > error occur when selinux_restorecon_default_handle return NULL in
> > restorecon_init.
> >
> > fixes: https://github.com/SELinuxProject/selinux/issues/249
> >
> > Signed-off-by: Ji Qin <jiqin.ji@huawei.com>
> 
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> 

Applied, thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-06-18 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-15  1:20 [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle Ji Qin
2020-06-15 11:39 ` Stephen Smalley
2020-06-18 19:33   ` Petr Lautrbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox