From: William Lallemand Date: Thu, 30 Oct 2025 10:54:49 +0000 (+0100) Subject: BUG/MINOR: ech: non destructive parsing in cli_find_ech_specific_ctx() X-Git-Tag: v3.3-dev11~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6503bd7d3a39973e2742462f9cdf3745ab3b3f3;p=thirdparty%2Fhaproxy.git 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. --- 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) {