1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
* intl/finddomain.c (_nl_find_domain): Protect calls to
	_nl_make_l10nflist.
This commit is contained in:
Ulrich Drepper
2004-09-26 03:40:38 +00:00
parent 4faf24a33d
commit f6b90f4299
2 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2004-09-25 Ulrich Drepper <drepper@redhat.com> 2004-09-25 Ulrich Drepper <drepper@redhat.com>
* intl/finddomain.c (_nl_find_domain): Protect calls to
_nl_make_l10nflist.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): If determinination of * sysdeps/posix/getaddrinfo.c (getaddrinfo): If determinination of
source address fails, initialized source_addr_len field so that source address fails, initialized source_addr_len field so that
duplicate address recognition does not copy junk. duplicate address recognition does not copy junk.

View File

@ -35,6 +35,7 @@
#include "gettextP.h" #include "gettextP.h"
#ifdef _LIBC #ifdef _LIBC
# include <libintl.h> # include <libintl.h>
# include <bits/libc-lock.h>
#else #else
# include "libgnuintl.h" # include "libgnuintl.h"
#endif #endif
@ -78,11 +79,17 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
(4) modifier (4) modifier
*/ */
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
__libc_lock_define_initialized (static, lock);
__libc_lock_lock (lock);
/* If we have already tested for this locale entry there has to /* If we have already tested for this locale entry there has to
be one data set in the list of loaded domains. */ be one data set in the list of loaded domains. */
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
strlen (dirname) + 1, 0, locale, NULL, NULL, strlen (dirname) + 1, 0, locale, NULL, NULL,
NULL, NULL, domainname, 0); NULL, NULL, domainname, 0);
__libc_lock_unlock (lock);
if (retval != NULL) if (retval != NULL)
{ {
/* We know something about this locale. */ /* We know something about this locale. */
@ -102,6 +109,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
if (retval->successor[cnt]->data != NULL) if (retval->successor[cnt]->data != NULL)
break; break;
} }
return cnt >= 0 ? retval : NULL; return cnt >= 0 ? retval : NULL;
/* NOTREACHED */ /* NOTREACHED */
} }
@ -132,12 +140,17 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
mask = _nl_explode_name (locale, &language, &modifier, &territory, mask = _nl_explode_name (locale, &language, &modifier, &territory,
&codeset, &normalized_codeset); &codeset, &normalized_codeset);
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
__libc_lock_lock (lock);
/* Create all possible locale entries which might be interested in /* Create all possible locale entries which might be interested in
generalization. */ generalization. */
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
strlen (dirname) + 1, mask, language, territory, strlen (dirname) + 1, mask, language, territory,
codeset, normalized_codeset, modifier, codeset, normalized_codeset, modifier,
domainname, 1); domainname, 1);
__libc_lock_unlock (lock);
if (retval == NULL) if (retval == NULL)
/* This means we are out of core. */ /* This means we are out of core. */
return NULL; return NULL;