1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

setup_transfer: deal with both sockets being -1

Detected by Coverity; CID 1435559.  Follow-up to f8d608f38d. It would
index the array with -1 if neither index was a socket.
This commit is contained in:
Daniel Stenberg 2018-05-11 23:54:26 +02:00
parent c3d7db4ecb
commit fe6b78b42d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -2021,7 +2021,8 @@ Curl_setup_transfer(
if(conn->bits.multiplex || conn->httpversion == 20) {
/* when multiplexing, the read/write sockets need to be the same! */
conn->sockfd = sockindex == -1 ?
conn->sock[writesockindex] : conn->sock[sockindex];
((writesockindex == -1 ? CURL_SOCKET_BAD : conn->sock[writesockindex])) :
conn->sock[sockindex];
conn->writesockfd = conn->sockfd;
}
else {