BUG/MINOR: deviceatlas: fix cookie vlen using wrong length after extraction

In da_haproxy_fetch(), vlen was set from v.len (the raw header value
length) instead of the truncated copy length. Also the cookie-specific
vlen calculation used an incorrect subtraction instead of the actual
extracted cookie value length (pl) returned by
http_extract_cookie_value().

This should be backported to lower branches.
This commit is contained in:
David Carlier 2026-02-14 13:23:59 +00:00 committed by Willy Tarreau
parent 7098b4f93a
commit 734a139c52

View file

@ -464,13 +464,12 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
memcpy(hbuf, n.ptr, n.len);
hbuf[n.len] = 0;
pval = v.ptr;
vlen = v.len;
evid = -1;
i = v.len > sizeof(tval) - 1 ? sizeof(tval) - 1 : v.len;
memcpy(tval, v.ptr, i);
tval[i] = 0;
pval = tval;
vlen = i;
if (strcasecmp(hbuf, "Accept-Language") == 0) {
evid = da_atlas_accept_language_evidence_id(&global_deviceatlas.atlas);
@ -488,7 +487,7 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
continue;
}
vlen -= global_deviceatlas.cookienamelen - 1;
vlen = pl;
pval = p;
evid = da_atlas_clientprop_evidence_id(&global_deviceatlas.atlas);
} else {