mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Check and
adjust the buffer alignment.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2008-12-31 Rafael Avila de Espindola <espindola@google.com>
|
||||||
|
|
||||||
|
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Check and
|
||||||
|
adjust the buffer alignment.
|
||||||
|
|
||||||
2009-01-07 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
2009-01-07 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
* sysdeps/mach/hurd/Makefile (sysdep_headers) [subdir=socket]:
|
* sysdeps/mach/hurd/Makefile (sysdep_headers) [subdir=socket]:
|
||||||
|
@ -115,7 +115,7 @@ static LIST_HEAD (stack_used);
|
|||||||
/* We need to record what list operations we are going to do so that,
|
/* We need to record what list operations we are going to do so that,
|
||||||
in case of an asynchronous interruption due to a fork() call, we
|
in case of an asynchronous interruption due to a fork() call, we
|
||||||
can correct for the work. */
|
can correct for the work. */
|
||||||
static uintptr_t *in_flight_stack;
|
static uintptr_t in_flight_stack;
|
||||||
|
|
||||||
/* List of the threads with user provided stacks in use. No need to
|
/* List of the threads with user provided stacks in use. No need to
|
||||||
initialize this, since it's done in __pthread_initialize_minimal. */
|
initialize this, since it's done in __pthread_initialize_minimal. */
|
||||||
@ -815,10 +815,10 @@ __reclaim_stacks (void)
|
|||||||
we have to be aware that we might have interrupted a list
|
we have to be aware that we might have interrupted a list
|
||||||
operation. */
|
operation. */
|
||||||
|
|
||||||
if (in_flight_stack != NULL)
|
if (in_flight_stack != 0)
|
||||||
{
|
{
|
||||||
bool add_p = in_flight_stack & 1;
|
bool add_p = in_flight_stack & 1;
|
||||||
in_flight_stack = (list_t *) (in_flight_stack & ~1l);
|
list_t *elem = (list_t *) (in_flight_stack & ~UINTMAX_C (1));
|
||||||
|
|
||||||
if (add_p)
|
if (add_p)
|
||||||
{
|
{
|
||||||
@ -828,11 +828,11 @@ __reclaim_stacks (void)
|
|||||||
{
|
{
|
||||||
if (l->next->prev != l)
|
if (l->next->prev != l)
|
||||||
{
|
{
|
||||||
assert (l->next->prev == in_flight_stack);
|
assert (l->next->prev == elem);
|
||||||
|
|
||||||
in_flight_stack->next = l->next;
|
elem->next = l->next;
|
||||||
in_flight_stack->prev = l;
|
elem->prev = l;
|
||||||
l->next = in_flight_stack;
|
l->next = elem;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -846,11 +846,11 @@ __reclaim_stacks (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We can simply always replay the delete operation. */
|
/* We can simply always replay the delete operation. */
|
||||||
in_flight_stack->next->prev = in_flight_stack->prev;
|
elem->next->prev = elem->prev;
|
||||||
in_flight_stack->prev->next = in_flight_stack->next;
|
elem->prev->next = elem->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_flight_stack = NULL;
|
in_flight_stack = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark all stacks except the still running one as free. */
|
/* Mark all stacks except the still running one as free. */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996-2004, 2007, 2008 Free Software Foundation, Inc.
|
/* Copyright (C) 1996-2004, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -376,6 +376,19 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
|
|||||||
int n, status;
|
int n, status;
|
||||||
int olderr = errno;
|
int olderr = errno;
|
||||||
|
|
||||||
|
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
|
||||||
|
buffer += pad;
|
||||||
|
buflen = buflen > pad ? buflen - pad : 0;
|
||||||
|
|
||||||
|
if (__builtin_expect (buflen < sizeof (struct host_data), 0))
|
||||||
|
{
|
||||||
|
*errnop = ERANGE;
|
||||||
|
*h_errnop = NETDB_INTERNAL;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
host_data = (struct host_data *) buffer;
|
||||||
|
|
||||||
if (__res_maybe_init (&_res, 0) == -1)
|
if (__res_maybe_init (&_res, 0) == -1)
|
||||||
return NSS_STATUS_UNAVAIL;
|
return NSS_STATUS_UNAVAIL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user