From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jeremy Sowden <jeremy@azazel.net>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nf v2] lib/ts_bm: reset initial match offset for every block of text
Date: Mon, 26 Jun 2023 17:16:03 +0200 [thread overview]
Message-ID: <ZJmrs+G4mNuoVnMs@calendula> (raw)
In-Reply-To: <20230619190657.1905910-1-jeremy@azazel.net>
On Mon, Jun 19, 2023 at 08:06:57PM +0100, Jeremy Sowden wrote:
> The `shift` variable which indicates the offset in the string at which
> to start matching the pattern is initialized to `bm->patlen - 1`, but it
> is not reset when a new block is retrieved. This means the implemen-
> tation may start looking at later and later positions in each successive
> block and miss occurrences of the pattern at the beginning. E.g.,
> consider a HTTP packet held in a non-linear skb, where the HTTP request
> line occurs in the second block:
>
> [... 52 bytes of packet headers ...]
> GET /bmtest HTTP/1.1\r\nHost: www.example.com\r\n\r\n
>
> and the pattern is "GET /bmtest".
>
> Once the first block comprising the packet headers has been examined,
> `shift` will be pointing to somewhere near the end of the block, and so
> when the second block is examined the request line at the beginning will
> be missed.
>
> Reinitialize the variable for each new block.
Applied to nf.git, thanks
prev parent reply other threads:[~2023-06-26 15:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 19:06 [PATCH nf v2] lib/ts_bm: reset initial match offset for every block of text Jeremy Sowden
2023-06-26 15:16 ` 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=ZJmrs+G4mNuoVnMs@calendula \
--to=pablo@netfilter.org \
--cc=jeremy@azazel.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).