netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH] monitor: Print NEWGEN events
Date: Mon, 24 Jul 2017 17:37:32 +0200	[thread overview]
Message-ID: <20170724153732.GQ16375@orbyte.nwl.cc> (raw)
In-Reply-To: <20170724111730.GA6691@salvia>

On Mon, Jul 24, 2017 at 01:17:30PM +0200, Pablo Neira Ayuso wrote:
> On Wed, Jul 19, 2017 at 04:32:57PM +0200, Phil Sutter wrote:
> > Now that they contain process information, they're actually interesting.
> > For backwards compatibility, print process information only if it was
> > present in the message.
> 
> Wait, a couple of comments.

All ACK, one remark:

[...]
> > +		case NFTA_GEN_PROC_NAME:
> > +			if (mnl_attr_validate(attr, MNL_TYPE_NUL_STRING) < 0)
> > +				break;
> > +			strncpy(name, mnl_attr_get_str(attr), sizeof(name));
> 
> What is maximum process name length? If we hit this bound, we have to
> make sure this does:
> 
>                         name[X - 1] = '\0';
> 
> Where X is the name buffer size.

NFTA_GEN_PROC_NAME attribute is filled with output from get_task_comm(),
which returns a string of max 16 bytes length. It is safe to assume that
it's NULL terminated since set_task_comm() uses strlcpy().

That static buffer above is needless though, so I'll change it to just
point to the netlink attribute itself if it is present.

Thanks, Phil

      reply	other threads:[~2017-07-24 15:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 14:32 [nft PATCH] monitor: Print NEWGEN events Phil Sutter
2017-07-24 11:09 ` Pablo Neira Ayuso
2017-07-24 11:17 ` Pablo Neira Ayuso
2017-07-24 15:37   ` Phil Sutter [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=20170724153732.GQ16375@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).