]> git.kaiwu.me - haproxy.git/commit
CLEANUP: map: always test pat->ref in sample_conv_map_key()
authorWilly Tarreau <w@1wt.eu>
Wed, 3 Jun 2026 12:36:37 +0000 (14:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 3 Jun 2026 12:45:54 +0000 (14:45 +0200)
commita7c64a5b12f8f205b5e0b7f044052d9993e21fa7
treee6c50fd76e3508502b40ebe228915fe25aff4a83
parentb79419026209276ae34ebf2b3330f8e6b57b1aa6
CLEANUP: map: always test pat->ref in sample_conv_map_key()

sample_conf_map_key() calls pattern_exec_match() which may return a
static pattern with ref=NULL when passed with fill=1 (which is the
case) and pat->match == NULL (which doesn't seem to be the case). It
doesn't seem it could happen with standard maps, as only "-m found"
drops has a NULL ->match function and there's no keyword associated
with it) but maybe this could happen with maps implemented in Lua,
though this remains unlikely.

Anyway better clarify the situation by always checking that the ref
is non-null before dereferencing it, it will at least avoid warnings
from code coverage tools.
src/map.c