netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [iproute PATCH v3 4/5] tc/tc_filter: Make sure filter name is not empty
Date: Mon, 21 Aug 2017 19:15:47 +0200	[thread overview]
Message-ID: <20170821171546.GA15994@orbyte.nwl.cc> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD005CC54@AcuExch.aculab.com>

On Mon, Aug 21, 2017 at 02:53:46PM +0000, David Laight wrote:
> From: Phil Sutter
> > Sent: 21 August 2017 11:03
> > To: Stephen Hemminger
> > Cc: netdev@vger.kernel.org
> > Subject: [iproute PATCH v3 4/5] tc/tc_filter: Make sure filter name is not empty
> > 
> > The later check for 'k[0] != 0' requires a non-empty filter name,
> > otherwise NULL pointer dereference in 'q' might happen.
> > 
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> > Changes since v2:
> > - Instead of calling strlen(), just make sure **argv is not 0.
> > ---
> >  tc/tc_filter.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tc/tc_filter.c b/tc/tc_filter.c
> > index b13fb9185d4fd..cf290ae8e252c 100644
> > --- a/tc/tc_filter.c
> > +++ b/tc/tc_filter.c
> > @@ -412,6 +412,9 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv)
> >  			usage();
> >  			return 0;
> >  		} else {
> > +			if (!**argv)
> > +				invarg("invalid filter name", *argv);
> > +
> 
> The error message won't make sense...

Hmm. It would print:

| Error: argument "" is wrong: invalid filter name

Since this parameter is not introduced by a previous one, I don't think
the error message could be made more precise. Do you have a better
suggestion?

Thanks, Phil

  reply	other threads:[~2017-08-21 17:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 10:03 [iproute PATCH v3 0/5] Covscan: Fix potential NULL pointer dereferences Phil Sutter
2017-08-21 10:03 ` [iproute PATCH v3 1/5] ifstat, nstat: Check fdopen() return value Phil Sutter
2017-08-21 10:03 ` [iproute PATCH v3 2/5] nstat: Fix for potential NULL pointer dereference Phil Sutter
2017-08-22  0:19   ` Stephen Hemminger
2017-08-21 10:03 ` [iproute PATCH v3 3/5] tc/q_netem: Don't dereference possibly NULL pointer Phil Sutter
2017-08-21 10:03 ` [iproute PATCH v3 4/5] tc/tc_filter: Make sure filter name is not empty Phil Sutter
2017-08-21 14:53   ` David Laight
2017-08-21 17:15     ` Phil Sutter [this message]
2017-08-21 10:03 ` [iproute PATCH v3 5/5] tipc/bearer: Prevent NULL pointer dereference Phil Sutter

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=20170821171546.GA15994@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=David.Laight@ACULAB.COM \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).