Re: [PATCH 1/2 libnftnl] Fix leak in nftnl_*_unset()

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

 



On 10 June 2016 at 12:20, Carlos Falgueras García <carlosfg@xxxxxxxxxx> wrote:
> Signed-off-by: Carlos Falgueras García <carlosfg@xxxxxxxxxx>
> ---
>  src/rule.c     | 1 +
>  src/set_elem.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/src/rule.c b/src/rule.c
> index 1e1a138..4c22436 100644
> --- a/src/rule.c
> +++ b/src/rule.c
> @@ -112,6 +112,7 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
>         case NFTNL_RULE_POSITION:
>         case NFTNL_RULE_FAMILY:
>         case NFTNL_RULE_USERDATA:
> +               xfree(r->user.data);
>                 break;
>         }
>

I think you need to isolate this NFTNL_RULE_USERDATA case from the
others by avoiding the fall through.

Example: an user calling nftnl_rule_unset() with NFTNL_RULE_FAMILY
will free 'r->user.data'. That doesn't seem correct.
-- 
Arturo Borrero González
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux