From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: andrei.popa@i-neo.ro, netfilter-devel@vger.kernel.org
Subject: Re: [oops] in text matching
Date: Wed, 28 Nov 2007 18:07:07 +0100 [thread overview]
Message-ID: <474DA03B.8050400@netfilter.org> (raw)
In-Reply-To: <474A791E.4010807@trash.net>
Patrick McHardy wrote:
> Pablo Neira Ayuso wrote:
>>> Pablo? I would prefer to get this fixed before 2.6.24, unless
>>> there's a better fix I'm going to include my patch to reject
>>> pattern lengths of 0. Thanks.
>>
>> Sorry for the late reply. Why should we accept zero length patterns?
>> Would you consider this patch? It keeps consistent the return value of
>> all textsearch approaches when a zero length pattern is passed.
>
> The other ones actually seem to handle it fine, and I think
> it should actually behave similar to memcmp or strcmp, so I'd
> prefer a patch to handle it properly by always matching.
Indeed, KMP supports zero length patterns but I don't know how :).
kmp_find() accesses kmp->pattern[0] -which actually points 4 bytes out
of the ts_config structure- to compare it with text[i], then if those 4
bytes doesn't match text[i], then returns a matching at position 1.
I think that a zero length pattern is a unspecified entry that we should
reject. Also, returning some error to tell the user that is passing a
zero length pattern -something that is probably what he didn't really
want as it happens to Andrei.
I can cook a patch for iptables to reject zero length pattern with a
nice error message, thus avoiding the EINVAL that will probably go nuts
users.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
next prev parent reply other threads:[~2007-11-28 17:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 12:40 [oops] in text matching Andrei Popa
2007-11-08 13:32 ` Patrick McHardy
2007-11-08 18:50 ` Andrei Popa
2007-11-08 18:53 ` Andrei Popa
2007-11-08 19:06 ` Andrei Popa
2007-11-10 12:57 ` Patrick McHardy
2007-11-13 6:51 ` Andrei Popa
2007-11-13 6:56 ` Patrick McHardy
2007-11-25 15:38 ` Patrick McHardy
2007-11-25 19:30 ` Pablo Neira Ayuso
2007-11-26 7:43 ` Patrick McHardy
2007-11-28 17:07 ` Pablo Neira Ayuso [this message]
2007-11-28 18:38 ` Patrick McHardy
2007-11-29 23:51 ` Patrick McHardy
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=474DA03B.8050400@netfilter.org \
--to=pablo@netfilter.org \
--cc=andrei.popa@i-neo.ro \
--cc=kaber@trash.net \
--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).