aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/connect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 918602c2d..1f4562a9a 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -692,8 +692,9 @@ singleipconnect(struct connectdata *conn,
addr->family=ai->ai_family;
addr->socktype=conn->socktype;
addr->protocol=ai->ai_protocol;
- addr->addrlen=(ai->ai_addrlen<=sizeof(struct Curl_sockaddr_storage))?
- ai->ai_addrlen:sizeof(struct Curl_sockaddr_storage);
+ addr->addrlen =
+ (ai->ai_addrlen < (socklen_t)sizeof(struct Curl_sockaddr_storage)) ?
+ ai->ai_addrlen : (socklen_t)sizeof(struct Curl_sockaddr_storage);
memcpy(&addr->addr, ai->ai_addr, addr->addrlen);
/* optionally use callback to get the socket */