bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] [PATCH RESEND] xattrs: Fix bug with --selinux option and u


From: Pádraig Brady
Subject: Re: [Bug-tar] [PATCH RESEND] xattrs: Fix bug with --selinux option and unlabeled files
Date: Wed, 01 Jul 2015 12:24:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 01/07/15 11:49, Pavel Raiskup wrote:
>>From 646ae813353ee8953eb0a4f6a06f4022015c151e Mon Sep 17 00:00:00 2001
> From: Pavel Raiskup <address@hidden>
> Date: Wed, 1 Jul 2015 12:30:57 +0200
> Subject: [PATCH] selinux-h: avoid double free after *getfilecon()
> 
> Originally reported by Ben Shelton on bug-tar:
> http://lists.gnu.org/archive/html/bug-tar/2015-04/msg00009.html
> 
> * lib/getfilecon.c (map_to_failure): Set the already freed '*con'
> pointer to NULL.  Man getfilecon(3) says that any non-NULL '*con'
> parameter should be freed by freecon(3) (regardless the return
> value).
> ---
>  lib/getfilecon.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/getfilecon.c b/lib/getfilecon.c
> index 2aa489e..86d2222 100644
> --- a/lib/getfilecon.c
> +++ b/lib/getfilecon.c
> @@ -57,6 +57,7 @@ map_to_failure (int ret, security_context_t *con)
>    if (ret == 10 && strcmp (*con, "unlabeled") == 0)
>      {
>        freecon (*con);
> +      *con = NULL;
>        errno = ENODATA;
>        return -1;
>      }
> -- 

Agreed. Applied to gnulib.

thanks!
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]