aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-26 15:39:23 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-26 15:39:23 +0000
commit7f8ad34ba2a646383eaee3d986ae493fed3e1536 (patch)
tree26a4e364274b14614c8c407dcbb322ae3cd06952 /lib/hostip.c
parenta9c030245462e3981534f1578f28498292c3f27d (diff)
Glen Nakamura made his fix look even better!
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 1707fd2d7..df054589d 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -530,8 +530,8 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
struct hostent hostentry;
char *h_addr_list[2];
struct in_addr addrentry;
- char h_name[1];
- } *buf = (struct namebuf *)malloc(sizeof(struct namebuf)+128);
+ char h_name[128];
+ } *buf = (struct namebuf *)malloc(sizeof(struct namebuf));
if(!buf)
return NULL; /* major failure */
*bufp = (char *)buf;
@@ -545,8 +545,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
h->h_addrtype = AF_INET;
h->h_length = sizeof(*addrentry);
h->h_name = &buf->h_name[0];
- MakeIP(ntohl(in), h->h_name,
- sizeof(struct namebuf)+128 - (long)(h->h_name) + (long)buf);
+ MakeIP(ntohl(in), h->h_name, sizeof(buf->h_name));
}
#if defined(HAVE_GETHOSTBYNAME_R)
else {