Re: [oops] in text matching

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

 



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
-
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