]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make sure resultbuf->h_addr_list addresses are correctly aligned.
authorUlrich Drepper <drepper@redhat.com>
Fri, 9 Jul 1999 20:35:28 +0000 (20:35 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 9 Jul 1999 20:35:28 +0000 (20:35 +0000)
nscd/nscd_gethst_r.c

index cb8f62e6963225ed8a385f890414d1e939fa67d1..38bf35ad8e3f93aabf4c353b8486e1a7d0a16298 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;