netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: Harsha Sharma <harshasharmaiitr@gmail.com>,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] evaluate: print error for null string befort assert statement
Date: Mon, 27 Nov 2017 23:51:11 +0100	[thread overview]
Message-ID: <20171127225111.GA28857@salvia> (raw)
In-Reply-To: <20171127224803.GC23412@breakpoint.cc>

On Mon, Nov 27, 2017 at 11:48:03PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Thu, Nov 23, 2017 at 10:25:51PM +0100, Florian Westphal wrote:
> > > Harsha Sharma <harshasharmaiitr@gmail.com> wrote:
> > > > Print error "Null string is not allowed" before assert statement.
> > > > For e.g.
> > > > nft add rule filter input meta iifname '""'
> > > > Error: Null String is not allowed
> > > > add rule filter input meta iifname ""
> > > 
> > > Is there any case where "" should be allowed?
> > > 
> > > If not, I'd rather change scanner.l to not recognize "" as
> > > a quoted string.
> > 
> > We'll get error reporting like this if we handle this from the
> > scanner:
> > 
> > # nft add rule x y ct label \"\"
> > Error: syntax error, unexpected junk
> > add rule x y ct label ""
> 
> Right, we'd have to add dummy empty_string rule to avoid this.
> 
> > This is just two extra lines in the validation step and it is not
> > worth to optimize an error case, ie. do it earlier. So I'm feeling
> > inclined to take this one.
> 
> Makes sense to me.
> 
> > I will mangle the error message to "Empty string is not allowed".
> > "Null" probably sounds too programmer thing.
> 
> Can you also get rid of the assert(strlen ... line?
> Its useless after this patch.

Indeed, done!

      reply	other threads:[~2017-11-27 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 18:55 [PATCH] evaluate: print error for null string befort assert statement Harsha Sharma
2017-11-23 21:25 ` Florian Westphal
2017-11-27 22:39   ` Pablo Neira Ayuso
2017-11-27 22:48     ` Florian Westphal
2017-11-27 22:51       ` Pablo Neira Ayuso [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=20171127225111.GA28857@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=harshasharmaiitr@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 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).