Repository navigation
Conversation
Return CURL_FORMADD_NULL before evaluating strlen on the option. Exercise both options in the existing formpost test. Reported-by: BS.ehlas.cz
|
Analysis of PR #23534 at d9f4a12a: Test ../../tests/http/test_02_download.py::TestDownload::test_02_33_max_host_conns[False-0-h2] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Note that this CI job has had a number of other flaky tests recently (2, to be specific) so it may be that this failure is rather a systemic issue with this job and not with this specific PR. Test 707 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 4 different CI jobs (the link just goes to one of them). Note that this CI job has had a number of other flaky tests recently (3, to be specific) so it may be that this failure is rather a systemic issue with this job and not with this specific PR. Generated by Testclutch |
bagder
left a comment
There was a problem hiding this comment.
I don't think the documentation actually allows a NULL there, but I'm fine with checking anyway as a service.
There was a problem hiding this comment.
🟢 Approval recommended
The focused guard prevents the NULL dereference, preserves existing error handling, and includes regression checks for both affected options.
No open issues 🎉
What changed in this PR
This PR fixes NULL-pointer handling in the legacy form API, returning the documented error instead of passing NULL to strlen().
Changes:
- Return
CURL_FORMADD_NULLfor NULLCURLFORM_FILENAMEandCURLFORM_BUFFERarguments. - Add regression checks for both options.
| File | Description |
|---|---|
| tests/libtest/lib1308.c | Tests that both NULL arguments return CURL_FORMADD_NULL. |
| lib/formdata.c | Checks for NULL before processing the filename. |
Review effort: Balanced
CURLFORM_FILENAMEandCURLFORM_BUFFERshare a branch that evaluatesstrlen(avalue)without checking whether the argument is NULL. The public header documentsCURL_FORMADD_NULLfor a NULL char pointer.This check returns
CURL_FORMADD_NULLbefore evaluatingstrlen(). Also add regression checks intests/libtest/lib1308.cto exercise both options.Vulnerability identified by BudgetScan static analysis.