From: Daniel Stenberg Date: Mon, 28 Jul 2025 13:54:59 +0000 (+0200) Subject: ws: avoid NULL pointer deref in curl_ws_recv X-Git-Tag: curl-8_16_0~344 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d2075bdce1234360bd41a9146ab9b465750a840;p=thirdparty%2Fcurl.git ws: avoid NULL pointer deref in curl_ws_recv If a NULL easy handle is passed in. Pointed out by Coverity Follow-up to 960fb4924523a853d5de8f30 Closes #18065 --- diff --git a/lib/ws.c b/lib/ws.c index 829ccfc822..ac542fbc14 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -1150,7 +1150,7 @@ CURLcode curl_ws_recv(CURL *d, void *buffer, const struct curl_ws_frame **metap) { struct Curl_easy *data = d; - struct connectdata *conn = data->conn; + struct connectdata *conn; struct websocket *ws; struct ws_collect ctx; @@ -1159,6 +1159,7 @@ CURLcode curl_ws_recv(CURL *d, void *buffer, if(!GOOD_EASY_HANDLE(data)) return CURLE_BAD_FUNCTION_ARGUMENT; + conn = data->conn; if(!conn) { /* Unhappy hack with lifetimes of transfers and connection */ if(!data->set.connect_only) {