From: Ulrich Drepper Date: Fri, 9 Jul 1999 20:35:28 +0000 (+0000) Subject: Make sure resultbuf->h_addr_list addresses are correctly aligned. X-Git-Tag: cvs/glibc_2-1-2~306 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e84df956c7e1cab241b3289a4aeffa79724d25a9;p=thirdparty%2Fglibc.git Make sure resultbuf->h_addr_list addresses are correctly aligned. --- diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index cb8f62e6963..38bf35ad8e3 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -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;