--- curl-7.10.6/lib/hostip.c	2003-07-25 15:13:38.000000000 +0100
+++ curl-7.10.6-patched/lib/hostip.c	2003-08-12 12:09:24.000000000 +0100
@@ -536,12 +536,17 @@
 static void hostcache_fixoffset(struct hostent *h, int offset)
 {
   int i=0;
+
   h->h_name=(char *)((long)h->h_name+offset);
+  if(h->h_aliases) {
+    /* only relocate aliases if there are any! */
   h->h_aliases=(char **)((long)h->h_aliases+offset);
   while(h->h_aliases[i]) {
     h->h_aliases[i]=(char *)((long)h->h_aliases[i]+offset);
     i++;
   }
+  }
+
   h->h_addr_list=(char **)((long)h->h_addr_list+offset);
   i=0;
   while(h->h_addr_list[i]) {
@@ -641,7 +646,7 @@
       *bufp=(char *)buf;
     }
     else
-#endif
+#endif /* HAVE_GETHOSTBYNAME_R_5 */
 #ifdef HAVE_GETHOSTBYNAME_R_6
     /* Linux */
     do {
@@ -690,7 +695,7 @@
       *bufp=(char *)buf;
     }
     else
-#endif
+#endif/* HAVE_GETHOSTBYNAME_R_6 */
 #ifdef HAVE_GETHOSTBYNAME_R_3
     /* AIX, Digital Unix, HPUX 10, more? */
 
@@ -725,14 +730,14 @@
     h = (struct hostent*)buf;
     h_errnop= errno; /* we don't deal with this, but set it anyway */
     if(ret)
-#endif
+#endif /* HAVE_GETHOSTBYNAME_R_3 */
       {
       infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
       h = NULL; /* set return code to NULL */
       free(buf);
       *bufp=NULL;
     }
-#else
+#else /* HAVE_GETHOSTBYNAME_R */
   else {
     if ((h = gethostbyname(hostname)) == NULL ) {
       infof(data, "gethostbyname(2) failed for %s\n", hostname);
@@ -747,8 +752,9 @@
       h = pack_hostent(&buf, h);
       *bufp=(char *)buf;
     }
-#endif
+#endif /*HAVE_GETHOSTBYNAME_R */
   }
+
   return (h);
 }
 

