]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: payload: always report a boolean from req.ssl_ec_ext
authorWilly Tarreau <w@1wt.eu>
Wed, 30 Sep 2026 09:23:40 +0000 (11:23 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Sep 2026 14:11:24 +0000 (16:11 +0200)
req.ssl_ec_ext is documented to return "a boolean identifying if client
sent the Supported Elliptic Curves Extension", but like a few other such
sample fetch functions, it fails to return false and incorrectly returns
a fetch failure instead. It must properly return false when the hello
parses correctly but doesn't have the EC extension instead of making the
sample fetch fail as if the hello was unparsable.

The bug was in the initial version in 1.6-dev3 with commit 5fc7d7e8ce
("MINOR: Add sample fetch to detect Supported Elliptic Curves Extension"),
so this fix can be backported to all stable branches.

src/payload.c

index 50da7c8a1a33d2fff3f7fd02efb98d94321ff3b2..dbc4a69cadd06a614f46ed35e2c40e2573b72bb9 100644 (file)
@@ -333,8 +333,12 @@ smp_fetch_req_ssl_ec_ext(const struct arg *args, struct sample *smp, const char
                hs_len -= 4 + ext_len;
                data   += 4 + ext_len;
        }
-       /* server name not found */
-       goto not_ssl_hello;
+
+       /* EC not found */
+       smp->data.type = SMP_T_BOOL;
+       smp->data.u.sint = 0;
+       smp->flags = SMP_F_VOLATILE;
+       return 1;
 
  too_short:
        smp->flags = SMP_F_MAY_CHANGE;