summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/Curl/connect.c10
-rw-r--r--Source/CTest/Curl/if2ip.c4
-rw-r--r--Source/CTest/Curl/url.c9
3 files changed, 16 insertions, 7 deletions
diff --git a/Source/CTest/Curl/connect.c b/Source/CTest/Curl/connect.c
index 65a8c0e..221a727 100644
--- a/Source/CTest/Curl/connect.c
+++ b/Source/CTest/Curl/connect.c
@@ -619,14 +619,14 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/* This is the loop that attempts to connect to all IP-addresses we
know for the given host. One by one. */
for(rc=-1, aliasindex=0;
- rc && (struct in_addr *)remotehost->addr->h_addr_list[aliasindex];
+ rc && (void *)remotehost->addr->h_addr_list[aliasindex];
aliasindex++) {
struct sockaddr_in serv_addr;
/* do this nasty work to do the connect */
memset((char *) &serv_addr, '\0', sizeof(serv_addr));
- memcpy((char *)&(serv_addr.sin_addr),
- (struct in_addr *)remotehost->addr->h_addr_list[aliasindex],
+ memcpy(&(serv_addr.sin_addr),
+ remotehost->addr->h_addr_list[aliasindex],
sizeof(struct in_addr));
serv_addr.sin_family = remotehost->addr->h_addrtype;
serv_addr.sin_port = htons((unsigned short)port);
@@ -706,8 +706,10 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/* leave the socket in non-blocking mode */
if(addr)
+ {
/* this is the address we've connected to */
- *addr = (struct in_addr *)remotehost->addr->h_addr_list[aliasindex];
+ memcpy(addr, &remotehost->addr->h_addr_list[aliasindex], sizeof(struct in_addr*));
+ }
#endif
/* allow NULL-pointers to get passed in */
diff --git a/Source/CTest/Curl/if2ip.c b/Source/CTest/Curl/if2ip.c
index 5f958d3..00fb9fb 100644
--- a/Source/CTest/Curl/if2ip.c
+++ b/Source/CTest/Curl/if2ip.c
@@ -106,7 +106,9 @@ char *Curl_if2ip(char *interface, char *buf, int buf_size)
else {
struct in_addr in;
- struct sockaddr_in *s = (struct sockaddr_in *)&req.ifr_dstaddr;
+ struct sockaddr_in *s;
+ struct sockaddr *sadd = &req.ifr_dstaddr;
+ memcpy(&s, &sadd, sizeof(struct sockaddr_in*));
memcpy(&in, &(s->sin_addr.s_addr), sizeof(in));
#if defined(HAVE_INET_NTOA_R)
ip = inet_ntoa_r(in,buf,buf_size);
diff --git a/Source/CTest/Curl/url.c b/Source/CTest/Curl/url.c
index 5d9250b..883e838 100644
--- a/Source/CTest/Curl/url.c
+++ b/Source/CTest/Curl/url.c
@@ -1531,7 +1531,10 @@ static int handleSock5Proxy(
#endif
}
- *((unsigned short*)&socksreq[8]) = htons(conn->remote_port);
+ {
+ unsigned short htons_res = htons(conn->remote_port);
+ memcpy(&socksreq[8], &htons_res, sizeof(unsigned short*));
+ }
{
const int packetsize = 10;
@@ -1554,11 +1557,13 @@ static int handleSock5Proxy(
return 1;
}
if (socksreq[1] != 0) { /* Anything besides 0 is an error */
+ unsigned short ntohs_arg;
+ memcpy(&ntohs_arg, &socksreq[8], sizeof(unsigned short*));
failf(conn->data,
"Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)",
(unsigned char)socksreq[4], (unsigned char)socksreq[5],
(unsigned char)socksreq[6], (unsigned char)socksreq[7],
- (unsigned int)ntohs(*(unsigned short*)(&socksreq[8])),
+ (unsigned int)ntohs(ntohs_arg),
socksreq[1]);
return 1;
}