Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Change #282063

Category curl
Changed by Ilias Aberkane <ilias.abkneohnoyoudont@gmail.com>
Changed at Thu 17 Sep 2026 14:58:43
Repository https://github.com/curl/curl.git
Project curl
Branch master
Revision c427e91ddea7c1d4b2f5c54ab4b6810f61483928

Comments

mime: bound Curl_mime_prepare_headers() recursion depth
The request-preparation path recursed once per nested multipart level
with no depth limit, so a deeply nested mime tree built by the
application exhausted the stack inside curl_easy_perform().

Thread a call_depth counter through the internal helper, bounded by
MAX_MIME_LEVELS. Deep trees now fail header preparation with
CURLE_TOO_LARGE instead of crashing.

Since header preparation always precedes the read paths, the depth
checks in the mime read functions become redundant and are removed.

Verify with test 3596: deeply nested mime trees fail with
CURLE_TOO_LARGE instead of exhausting the stack.

Fixes #22971
Reported-by: Fengxiaoxx on github
Closes #22980

Changed files