From: Florian Westphal <fw@strlen.de>
To: Ana Rey <anarey@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [libnftnl PATCH] target: Fix an invalid read.
Date: Sun, 13 Apr 2014 20:21:08 +0200 [thread overview]
Message-ID: <20140413182108.GK31953@breakpoint.cc> (raw)
In-Reply-To: <3a6157fa2be7124bafa2b681acb65eea9be432d2.1397411873.git.anarey@gmail.com>
Ana Rey <anarey@gmail.com> wrote:
> --- a/src/expr/target.c
> +++ b/src/expr/target.c
> @@ -42,8 +42,8 @@ nft_rule_expr_target_set(struct nft_rule_expr *e, uint16_t type,
>
> switch(type) {
> case NFT_EXPR_TG_NAME:
> - memcpy(tg->name, data, XT_EXTENSION_MAXNAMELEN);
> - tg->name[XT_EXTENSION_MAXNAMELEN-1] = '\0';
> + memcpy(tg->name, data, strlen(data));
This can overflow tg->name, since the size of the source
is tested instead of destination.
What about:
snprintf(tg->name, sizeof(tg->name), "%.*s", data_len, (const char *) data);
?
prev parent reply other threads:[~2014-04-13 18:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-13 18:08 [libnftnl PATCH] target: Fix an invalid read Ana Rey
2014-04-13 18:08 ` [libnftnl PATCH] tests: Fix a memory leak Ana Rey
2014-04-14 8:49 ` Pablo Neira Ayuso
2014-04-13 18:21 ` Florian Westphal [this message]
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=20140413182108.GK31953@breakpoint.cc \
--to=fw@strlen.de \
--cc=anarey@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.