From a334319f6530564d22e775935d9c91663623a1b4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Dec 2004 20:10:10 +0000 Subject: (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. --- resolv/nss_dns/dns-host.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'resolv/nss_dns/dns-host.c') diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index cf060be8ef..7045c5915b 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2003, 2004, 2007 Free Software Foundation, Inc. +/* Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Extended from original form by Ulrich Drepper , 1996. @@ -465,8 +465,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, char *aliases[MAX_NR_ALIASES]; unsigned char host_addr[16]; /* IPv4 or IPv6 */ char *h_addr_ptrs[0]; - } *host_data; - int linebuflen; + } *host_data = (struct host_data *) buffer; + int linebuflen = buflen - sizeof (struct host_data); register const HEADER *hp; const u_char *end_of_message, *cp; int n, ancount, qdcount; @@ -478,9 +478,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, u_char packtmp[NS_MAXCDNAME]; int have_to_map = 0; int32_t ttl = 0; - uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data); - buffer += pad; - if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0)) + + if (__builtin_expect (linebuflen, 0) < 0) { /* The buffer is too small. */ too_small: @@ -488,10 +487,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, *h_errnop = NETDB_INTERNAL; return NSS_STATUS_TRYAGAIN; } - host_data = (struct host_data *) buffer; - linebuflen = buflen - sizeof (struct host_data); - if (buflen - sizeof (struct host_data) != linebuflen) - linebuflen = INT_MAX; tname = qname; result->h_name = NULL; -- cgit v1.2.3