mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-08 16:23:24 -04:00
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.
This commit is contained in:
parent
b794190262
commit
a7c64a5b12
1 changed files with 1 additions and 1 deletions
|
|
@ -186,7 +186,7 @@ static int sample_conv_map_key(const struct arg *arg_p, struct sample *smp, void
|
|||
pat = pattern_exec_match(&desc->pat, smp, 1);
|
||||
|
||||
/* Match case. */
|
||||
if (pat) {
|
||||
if (pat && pat->ref) {
|
||||
smp->data.type = SMP_T_STR;
|
||||
smp->flags |= SMP_F_CONST;
|
||||
smp->data.u.str.area = (char *)pat->ref->pattern;
|
||||
|
|
|
|||
Loading…
Reference in a new issue