mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
attempt to fix or allow further detection of an elusive icc SIGSEGV
This commit is contained in:
parent
bb1f6e6818
commit
c455254fd1
@ -293,9 +293,8 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|||||||
|
|
||||||
struct namebuf6 {
|
struct namebuf6 {
|
||||||
struct hostent hostentry;
|
struct hostent hostentry;
|
||||||
char *h_addr_list[2];
|
|
||||||
struct in6_addr addrentry;
|
struct in6_addr addrentry;
|
||||||
char hostname[1];
|
char *h_addr_list[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -312,8 +311,8 @@ Curl_addrinfo *Curl_ip2addr6(struct in6_addr *in,
|
|||||||
{
|
{
|
||||||
Curl_addrinfo *ai;
|
Curl_addrinfo *ai;
|
||||||
|
|
||||||
#if defined(VMS) && defined(__INITIAL_POINTER_SIZE) && \
|
#if defined(VMS) && \
|
||||||
(__INITIAL_POINTER_SIZE == 64)
|
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
|
||||||
#pragma pointer_size save
|
#pragma pointer_size save
|
||||||
#pragma pointer_size short
|
#pragma pointer_size short
|
||||||
#pragma message disable PTRMISMATCH
|
#pragma message disable PTRMISMATCH
|
||||||
@ -321,32 +320,42 @@ Curl_addrinfo *Curl_ip2addr6(struct in6_addr *in,
|
|||||||
|
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
struct in6_addr *addrentry;
|
struct in6_addr *addrentry;
|
||||||
struct namebuf6 *buf = malloc(sizeof (struct namebuf6) + strlen(hostname));
|
struct namebuf6 *buf;
|
||||||
|
char *hoststr;
|
||||||
|
|
||||||
|
DEBUGASSERT(in && hostname);
|
||||||
|
|
||||||
|
buf = malloc(sizeof(struct namebuf6));
|
||||||
if(!buf)
|
if(!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
h = &buf->hostentry;
|
hoststr = strdup(hostname);
|
||||||
h->h_addr_list = &buf->h_addr_list[0];
|
if(!hoststr) {
|
||||||
|
free(buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
addrentry = &buf->addrentry;
|
addrentry = &buf->addrentry;
|
||||||
memcpy(addrentry, in, sizeof (*in));
|
memcpy(addrentry, in, sizeof(struct in6_addr));
|
||||||
h->h_addr_list[0] = (char*)addrentry;
|
|
||||||
h->h_addr_list[1] = NULL; /* terminate list of entries */
|
h = &buf->hostentry;
|
||||||
h->h_name = &buf->hostname[0];
|
h->h_name = hoststr;
|
||||||
h->h_aliases = NULL;
|
h->h_aliases = NULL;
|
||||||
h->h_addrtype = AF_INET6;
|
h->h_addrtype = AF_INET6;
|
||||||
|
h->h_length = sizeof(struct in6_addr);
|
||||||
|
h->h_addr_list = &buf->h_addr_list[0];
|
||||||
|
h->h_addr_list[0] = (char*)addrentry;
|
||||||
|
h->h_addr_list[1] = NULL; /* terminate list of entries */
|
||||||
|
|
||||||
/* Now store the dotted version of the address */
|
#if defined(VMS) && \
|
||||||
strcpy (h->h_name, hostname);
|
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
|
||||||
|
|
||||||
#if defined(VMS) && defined(__INITIAL_POINTER_SIZE) && \
|
|
||||||
(__INITIAL_POINTER_SIZE == 64)
|
|
||||||
#pragma pointer_size restore
|
#pragma pointer_size restore
|
||||||
#pragma message enable PTRMISMATCH
|
#pragma message enable PTRMISMATCH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ai = Curl_he2ai(h, port);
|
ai = Curl_he2ai(h, port);
|
||||||
|
|
||||||
|
free(hoststr);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
return ai;
|
return ai;
|
||||||
|
42
lib/hostip.c
42
lib/hostip.c
@ -733,11 +733,10 @@ void Curl_freeaddrinfo(Curl_addrinfo *ai)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct namebuf {
|
struct namebuf4 {
|
||||||
struct hostent hostentry;
|
struct hostent hostentry;
|
||||||
char *h_addr_list[2];
|
|
||||||
struct in_addr addrentry;
|
struct in_addr addrentry;
|
||||||
char h_name[16]; /* 123.123.123.123 = 15 letters is maximum */
|
char *h_addr_list[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -762,11 +761,21 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
|
|||||||
|
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
struct in_addr *addrentry;
|
struct in_addr *addrentry;
|
||||||
struct namebuf buffer;
|
struct namebuf4 *buf;
|
||||||
struct namebuf *buf = &buffer;
|
char *hoststr;
|
||||||
|
|
||||||
|
DEBUGASSERT(hostname);
|
||||||
|
|
||||||
|
buf = malloc(sizeof(struct namebuf4));
|
||||||
|
if(!buf)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
hoststr = strdup(hostname);
|
||||||
|
if(!hoststr) {
|
||||||
|
free(buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
h = &buf->hostentry;
|
|
||||||
h->h_addr_list = &buf->h_addr_list[0];
|
|
||||||
addrentry = &buf->addrentry;
|
addrentry = &buf->addrentry;
|
||||||
#ifdef _CRAYC
|
#ifdef _CRAYC
|
||||||
/* On UNICOS, s_addr is a bit field and for some reason assigning to it
|
/* On UNICOS, s_addr is a bit field and for some reason assigning to it
|
||||||
@ -776,15 +785,15 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
|
|||||||
#else
|
#else
|
||||||
addrentry->s_addr = num;
|
addrentry->s_addr = num;
|
||||||
#endif
|
#endif
|
||||||
h->h_addr_list[0] = (char*)addrentry;
|
|
||||||
h->h_addr_list[1] = NULL;
|
|
||||||
h->h_addrtype = AF_INET;
|
|
||||||
h->h_length = sizeof(*addrentry);
|
|
||||||
h->h_name = &buf->h_name[0];
|
|
||||||
h->h_aliases = NULL;
|
|
||||||
|
|
||||||
/* Now store the dotted version of the address */
|
h = &buf->hostentry;
|
||||||
snprintf(h->h_name, 16, "%s", hostname);
|
h->h_name = hoststr;
|
||||||
|
h->h_aliases = NULL;
|
||||||
|
h->h_addrtype = AF_INET;
|
||||||
|
h->h_length = sizeof(struct in_addr);
|
||||||
|
h->h_addr_list = &buf->h_addr_list[0];
|
||||||
|
h->h_addr_list[0] = (char*)addrentry;
|
||||||
|
h->h_addr_list[1] = NULL; /* terminate list of entries */
|
||||||
|
|
||||||
#if defined(VMS) && \
|
#if defined(VMS) && \
|
||||||
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
|
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
|
||||||
@ -794,6 +803,9 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
|
|||||||
|
|
||||||
ai = Curl_he2ai(h, port);
|
ai = Curl_he2ai(h, port);
|
||||||
|
|
||||||
|
free(hoststr);
|
||||||
|
free(buf);
|
||||||
|
|
||||||
return ai;
|
return ai;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user