From f6503bd7d3a39973e2742462f9cdf3745ab3b3f3 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Thu, 30 Oct 2025 11:54:49 +0100 Subject: [PATCH] BUG/MINOR: ech: non destructive parsing in cli_find_ech_specific_ctx() cli_find_ech_specific_ctx() parses the / and sets a \0 in place the '/'. But the originals tring is still used to emit messages in the CLI so we only output the frontend part. This patch do the parsing in a trash buffer instead. --- src/ech.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ech.c b/src/ech.c index 717f18ba1..2acd898e1 100644 --- a/src/ech.c +++ b/src/ech.c @@ -84,25 +84,27 @@ end: return rv; } -/* +/* find a named SSL_CTX, returns 1 if found + * * should be in the format "frontend/@:" * Example: * "http1/@haproxy.cfg:1234" - * */ - -/* find a named SSL_CTX, returns 1 if found */ -static int cli_find_ech_specific_ctx(char *name, SSL_CTX **sctx) +static int cli_find_ech_specific_ctx(const char *name, SSL_CTX **sctx) { struct proxy *p; struct bind_conf *bind_conf; char *pname; /* proxy name */ char *bname; /* bind_name */ + struct buffer *tmp = get_trash_chunk(); if (!name || !sctx) return 0; - for (pname = bname = name; *bname != '\0' && *bname != '/'; bname++) + + b_putblk(tmp, name, strlen(name) + 1); + + for (pname = bname = tmp->area; *bname != '\0' && *bname != '/'; bname++) ; if (*bname) { -- 2.47.3