From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Carlos Falgueras García" <carlosfg@riseup.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH libnfntl] Check all strdup
Date: Mon, 30 May 2016 19:16:34 +0200 [thread overview]
Message-ID: <20160530171634.GA1017@salvia> (raw)
In-Reply-To: <1464627822-6173-1-git-send-email-carlosfg@riseup.net>
On Mon, May 30, 2016 at 07:03:42PM +0200, Carlos Falgueras García wrote:
> diff --git a/src/set.c b/src/set.c
> index dbea93b..65b8f1e 100644
> --- a/src/set.c
> +++ b/src/set.c
> @@ -291,10 +295,16 @@ struct nftnl_set *nftnl_set_clone(const struct nftnl_set *set)
>
> memcpy(newset, set, sizeof(*set));
>
> - if (set->flags & (1 << NFTNL_SET_TABLE))
> + if (set->flags & (1 << NFTNL_SET_TABLE)) {
> newset->table = strdup(set->table);
> - if (set->flags & (1 << NFTNL_SET_NAME))
> + if (!newset->table)
> + return NULL;
> + }
> + if (set->flags & (1 << NFTNL_SET_NAME)) {
> newset->name = strdup(set->name);
> + if (!newset->name)
> + return NULL;
> + }
This is leaking the clone object.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-05-30 17:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-30 17:03 [PATCH libnfntl] Check all strdup Carlos Falgueras García
2016-05-30 17:16 ` Pablo Neira Ayuso [this message]
2016-05-31 10:07 ` Carlos Falgueras García
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160530171634.GA1017@salvia \
--to=pablo@netfilter.org \
--cc=carlosfg@riseup.net \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).