]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mux-fcgi: check the room left before appending the index
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 6 Aug 2026 07:21:38 +0000 (09:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Aug 2026 08:29:19 +0000 (10:29 +0200)
commita01ba66bc2573105717a0f4f58b2b48667f1ccba
tree2fe4463c539eae1dcc2eb6afd2a3fc865c0cae0c
parentc0b39ea75e76e058b7056ad2614d45e4a0cdac95
BUG/MEDIUM: mux-fcgi: check the room left before appending the index

In fcgi_set_default_param(), when the decoded path ends with a '/' and the
fcgi-app declares an "index", params->scriptname is set to span the path
plus the index before both are appended to the trash chunk, and the return
value of these appends is ignored. If the chunk is full, nothing is written
but scriptname still points past its tail, so SCRIPT_NAME and
SCRIPT_FILENAME are encoded from memory located past the end of the chunk
and sent to the FastCGI application. The copy of the path a few lines above
was not checked either. Since the URI is copied into the chunk first and
the path copied again, a path larger than about a third of a buffer is
enough to reach this.

Let's check both appends and only publish the script name once its content
is really there.

Reported-by: Claude (ANT-2026-WPM4GZPQ)
src/mux_fcgi.c