Re: [PATCH] evaluate: print error for null string befort assert statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> On Thu, Nov 23, 2017 at 10:25:51PM +0100, Florian Westphal wrote:
> > Harsha Sharma <harshasharmaiitr@xxxxxxxxx> 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.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux