Potential Resource Leak in tool_parsecfg.c at line 279 during fileerror
A static analyser flagged a possible file descriptor leak in curl's config parsing code, where an error path returns without closing the opened file stream. If real, a local attacker could repeatedly trigger the error to exhaust file descriptors and cause a denial of service.
Originally disclosed on HackerOne
- Disclosed after 2 days
Summary: A resource leak was identified in src/tool_parsecfg.c using the Clang Static Analyzer. When a file error occurs (fileerror is true) during config parsing, the function returns PARAM_READ_ERROR without ensuring the file stream is properly closed, leading to a potential file descriptor leak.
Steps to Reproduce:
1. Analyze the curl source code using scan-build make.
2. Observe the report for src/tool_parsecfg.c.
3. The analyzer identifies that at line 264, if fileerror is triggered, the control flow reaches the return statement at line 279 without
a confirmed fclose on the opened stream.
Impact
Impact: A local attacker could potentially cause a Denial of Service (DoS) by repeatedly triggering this error path, leading to file descriptor exhaustion.
Attachments

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an early return on the file error path skips the fclose call for the opened stream.
Impact
A local attacker could potentially cause a denial of service by repeatedly triggering this error path until file descriptors are exhausted; the finding is from static analysis and no runtime exploitation is shown.
What the attacker needed
Local access to run curl; ability to trigger the file error path
How it was found
- Run the Clang Static Analyzer over the curl source with scan-build make.
- Look at the report generated for the config parsing source file.
- Note the path where a file error leads to a return without a confirmed fclose.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program opens a file, it gets a handle called a file descriptor that must be given back when finished. This report says one error path in curl's config parser may return early without giving the handle back. If that happens often enough, the program runs out of handles and stops working properly.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.