aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-05-11 23:54:26 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-05-11 23:56:37 +0200
commitfe6b78b42dee1d33a2a225de6e42d0d922d4fe10 (patch)
tree6142cb9066cb680fd3ce7b37cfaa3c68287b840a
parentc3d7db4ecb2f8a0b22bd7cdf54ef10c119ebcc48 (diff)
setup_transfer: deal with both sockets being -1
Detected by Coverity; CID 1435559. Follow-up to f8d608f38d00. It would index the array with -1 if neither index was a socket.
-rw-r--r--lib/transfer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 6bf95c576..131f2dc7c 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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 {