(nscd_gethst_r): Make sure resultbuf->h_addr_list addresses are
authordrepper <drepper>
Fri, 9 Jul 1999 20:32:29 +0000 (20:32 +0000)
committerdrepper <drepper>
Fri, 9 Jul 1999 20:32:29 +0000 (20:32 +0000)
correctly aligned.

nscd/nscd_gethst_r.c

index cb8f62e..6ee0826 100644 (file)
@@ -214,6 +214,12 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
                   + hst_resp.h_aliases_cnt * sizeof (size_t));
 
       n = 2;
+
+      /* These things must be aligned or ntohl will cause havoc.  */
+      align = ((__alignof__ (char *) - (cp - ((char *) 0)))
+              & (__alignof__ (char *) - 1));
+      cp += align;
+
       if (type == GETHOSTBYADDR || type == GETHOSTBYNAME)
        {
          vec[2].iov_base = cp;