From: Kelly Kane Date: Tue, 17 Nov 2026 22:15:43 +0000 (+0000) Subject: BUG/MEDIUM: mux-fcgi: avoid out-of-bounds path decoding X-Git-Url: https://git.kaiwu.me/http/control.html?a=commitdiff_plain;h=785b1576213f39416abd48c4316747eac0387c5e;p=haproxy.git BUG/MEDIUM: mux-fcgi: avoid out-of-bounds path decoding A client request can make the FastCGI path copy exactly fill its scratch buffer. b_tail() then wraps to the start, so subtracting the path length points before the buffer. URL decoding reads and writes there instead of reading the copied path. Require one free byte for ist0()'s terminator. The request then follows the existing error path; ordinary paths keep working. Commit a01ba66bc2 rejected oversized copies but missed exact fits. This should be backported to affected stable branches. Signed-off-by: Kelly Kane --- diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index ff7554ea0..01f726bfb 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -1382,9 +1382,9 @@ static int fcgi_set_default_param(struct fcgi_conn *fconn, struct fcgi_strm *fst } /* Decode the path. it must first be copied to keep the URI - * untouched. + * untouched. Keep room for the terminating zero added by ist0(). */ - if (!chunk_istcat(params->p, path)) + if (path.len >= b_room(params->p) || !chunk_istcat(params->p, path)) goto error; path.ptr = b_tail(params->p) - path.len; len = url_decode(ist0(path), 0);