aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ares/ares_getnameinfo.c6
-rw-r--r--ares/ares_process.c4
-rw-r--r--lib/ftp.c4
-rw-r--r--lib/sslgen.c2
-rw-r--r--src/urlglob.c4
5 files changed, 11 insertions, 9 deletions
diff --git a/ares/ares_getnameinfo.c b/ares/ares_getnameinfo.c
index 51e36fb10..117c6c9a4 100644
--- a/ares/ares_getnameinfo.c
+++ b/ares/ares_getnameinfo.c
@@ -110,7 +110,8 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t
port = addr->sin_port;
else
port = addr6->sin6_port;
- service = lookup_service(port, flags, buf, sizeof(buf));
+ service = lookup_service((unsigned short)(port & 0xffff),
+ flags, buf, sizeof(buf));
callback(arg, ARES_SUCCESS, NULL, service);
return;
}
@@ -151,7 +152,8 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t
}
/* They also want a service */
if (flags & ARES_NI_LOOKUPSERVICE)
- service = lookup_service(port, flags, srvbuf, sizeof(srvbuf));
+ service = lookup_service((unsigned short)(port & 0xffff),
+ flags, srvbuf, sizeof(srvbuf));
callback(arg, ARES_SUCCESS, ipbuf, service);
return;
}
diff --git a/ares/ares_process.c b/ares/ares_process.c
index a3a25ba48..4b4ff35a7 100644
--- a/ares/ares_process.c
+++ b/ares/ares_process.c
@@ -609,7 +609,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
memset(&sockin, 0, sizeof(sockin));
sockin.sin_family = AF_INET;
sockin.sin_addr = server->addr;
- sockin.sin_port = channel->tcp_port;
+ sockin.sin_port = (unsigned short)(channel->tcp_port & 0xffff);
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1) {
int err = GET_ERRNO();
@@ -642,7 +642,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
memset(&sockin, 0, sizeof(sockin));
sockin.sin_family = AF_INET;
sockin.sin_addr = server->addr;
- sockin.sin_port = channel->udp_port;
+ sockin.sin_port = (unsigned short)(channel->udp_port & 0xffff);
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1)
{
closesocket(s);
diff --git a/lib/ftp.c b/lib/ftp.c
index 00aca12ee..479eeffe3 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1586,7 +1586,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
}
}
if(ptr) {
- newport = num;
+ newport = (unsigned short)(num & 0xffff);
if (conn->bits.tunnel_proxy)
/* proxy tunnel -> use other host info because ip_addr_str is the
@@ -1650,7 +1650,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
else
snprintf(newhost, sizeof(newhost),
"%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
- newport = (port[0]<<8) + port[1];
+ newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff);
}
else if(ftpc->count1 == 0) {
/* EPSV failed, move on to PASV */
diff --git a/lib/sslgen.c b/lib/sslgen.c
index f110a51ea..5b75c3807 100644
--- a/lib/sslgen.c
+++ b/lib/sslgen.c
@@ -608,7 +608,7 @@ bool Curl_ssl_data_pending(struct connectdata *conn,
/* OpenSSL-specific */
if(conn->ssl[connindex].handle)
/* SSL is in use */
- return SSL_pending(conn->ssl[connindex].handle);
+ return (bool)(0 != SSL_pending(conn->ssl[connindex].handle));
#else
(void)conn;
(void)connindex;
diff --git a/src/urlglob.c b/src/urlglob.c
index ba4fb1eae..214c5c984 100644
--- a/src/urlglob.c
+++ b/src/urlglob.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -422,7 +422,7 @@ char *glob_next_url(URLGlob *glob)
}
break;
case UPTCharRange:
- pat->content.CharRange.ptr_c += pat->content.CharRange.step;
+ pat->content.CharRange.ptr_c += (char)(pat->content.CharRange.step);
if (pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) {
pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;
carry = TRUE;