]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] multipattern: fix TLD pattern matching after hyperscan hot-swap
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 1 Feb 2026 15:52:56 +0000 (15:52 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 1 Feb 2026 15:52:56 +0000 (15:52 +0000)
commit183ecd3da6c26d8dade8fa1a76b1d64876dee17e
tree0f00a141774f53a4d1400c68510a31a402402d2d
parente9e6bac43a84fe6823a88b9c530823b212dd3571
[Fix] multipattern: fix TLD pattern matching after hyperscan hot-swap

The hyperscan TLD pattern suffix (?:[^a-zA-Z0-9]|$) was consuming the
boundary character, causing match length to be one character too long.
This broke URL detection in url_tld_end() after workers hot-swapped
from ACISM to hyperscan.

Root cause: For input "adobesign.github.io/?u=xxx":
- ACISM pattern ".github.io" -> match length 10, p points to "/"
- Hyperscan pattern "\.github.io(?:[^a-zA-Z0-9]|$)" -> match length 11,
  p points to "?" (one past expected)

url_tld_end() checks if *p == '/' which failed for hyperscan.

Fix: Remove suffix from hyperscan TLD patterns and add boundary checking
in rspamd_multipattern_hs_cb(), mirroring what ACISM callback already does.
This ensures consistent match length between both backends.
src/libutil/multipattern.c