From: David Carlier Date: Sat, 14 Feb 2026 13:23:59 +0000 (+0000) Subject: BUG/MINOR: deviceatlas: fix cookie vlen using wrong length after extraction X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=734a139c522be5c3a160097bece21750095ad218;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/addons/deviceatlas/da.c b/addons/deviceatlas/da.c index 3532c5541..24b513592 100644 --- a/addons/deviceatlas/da.c +++ b/addons/deviceatlas/da.c @@ -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 {