Applied, thank you

On Wed, Oct 1, 2025 at 10:05 PM Osama Abdelkader
<[email protected]> wrote:
>
> Remove the puts(cterm) call that was likely leftover debugging code.
> The controlling terminal name is already properly displayed via the
> 'Controlling term:' label, so the raw terminal name output was redundant
> and could cause issues when cterm is NULL.
>
> Also add proper cleanup for the allocated cterm string.
>
> Fixes: potential segfault in sestatus -v mode when terminal name cannot be 
> determined
> Signed-off-by: Osama Abdelkader <[email protected]>
> ---
> v2: Remove the puts(cterm) call that was likely leftover debugging code.
> ---
>  selinux/sestatus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/selinux/sestatus.c b/selinux/sestatus.c
> index 098a4d189..cf664cc18 100644
> --- a/selinux/sestatus.c
> +++ b/selinux/sestatus.c
> @@ -131,13 +131,13 @@ static void display_verbose(void)
>         puts("\nFile contexts:");
>
>         cterm = xmalloc_ttyname(0);
> -//FIXME: if cterm == NULL, we segfault!??
> -       puts(cterm);
>         if (cterm && lgetfilecon(cterm, &con) >= 0) {
>                 printf(COL_FMT "%s\n", "Controlling term:", con);
>                 if (ENABLE_FEATURE_CLEAN_UP)
>                         freecon(con);
>         }
> +       if (ENABLE_FEATURE_CLEAN_UP)
> +               free(cterm);
>
>         for (i = 0; fc[i] != NULL; i++) {
>                 struct stat stbuf;
> --
> 2.43.0
>
> _______________________________________________
> busybox mailing list
> [email protected]
> https://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to