mirror of
https://github.com/curl/curl.git
synced 2026-06-05 16:54:14 +03:00
openssl: fix "Improper use of negative value"
By getting the socket first and returning error in case of bad socket. Detected by Coverity. Closes #10423
This commit is contained in:
parent
30607e77dc
commit
b0b33fe71d
1 changed files with 4 additions and 1 deletions
|
|
@ -1814,7 +1814,10 @@ static int ossl_check_cxn(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
#ifdef MSG_PEEK
|
||||
char buf;
|
||||
ssize_t nread;
|
||||
nread = recv((RECV_TYPE_ARG1)Curl_conn_cf_get_socket(cf, data),
|
||||
curl_socket_t sock = Curl_conn_cf_get_socket(cf, data);
|
||||
if(sock == CURL_SOCKET_BAD)
|
||||
return 0; /* no socket, consider closed */
|
||||
nread = recv((RECV_TYPE_ARG1)sock,
|
||||
(RECV_TYPE_ARG2)&buf, (RECV_TYPE_ARG3)1,
|
||||
(RECV_TYPE_ARG4)MSG_PEEK);
|
||||
if(nread == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue