Repository navigation
Conversation
Return CURLE_BAD_FUNCTION_ARGUMENT when NULL has been passed as 'recv' or 'metap' to curl_ws_recv(), and initialize the output values only after validating pointers inside the API guard.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address the output-initialization regression and add regression tests.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR hardens curl_ws_recv() against NULL output-pointer dereferences.
Changes:
- Moves output initialization inside the API guard.
- Validates output pointers and returns
CURLE_BAD_FUNCTION_ARGUMENT.
| File | Review |
|---|---|
lib/ws.c |
Moderate issue: output parameters may remain uncleared for invalid buffers. Nit: add regression coverage for NULL pointers and handles. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Analysis of PR #23050 at ef72aa89: Test 1041 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 12 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. Generated by Testclutch |
|
Thanks |

Summary
In
curl_ws_recv()(lib/ws.c),*recv = 0;and*metap = NULL;were dereferenced unconditionally at the start of the function before checking whetherrecvormetapare NULL, and before enteringCURL_EAPI_ENTER(&guard, curl, ws_recv, &result).Passing
NULLasrecvormetap(or calling with an invalid handle andNULLout-pointers) caused an immediate crash due to a NULL pointer dereference (SIGSEGV).This patch moves pointer initialization inside the
CURL_EAPI_ENTERguard and validates!recv || !metap, returningCURLE_BAD_FUNCTION_ARGUMENTif either pointer is NULL, following the precedent set forcurl_easy_send()andcurl_easy_recv()in f2a1535.