The format of locale data can be incompatible between libc versions, and loading incompatible data can lead to 'setlocale' returning EINVAL at best or triggering an assertion failure at worst. See https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00717.html for background information. To address that, this patch changes libc to honor a new 'GUIX_LOCPATH' variable, and to look for locale data in version-specific sub-directories of that variable. So, if GUIX_LOCPATH=/foo:/bar, locale data is searched for in /foo/X.Y and /bar/X.Y, where X.Y is the libc version number. That way, a single 'GUIX_LOCPATH' setting can work even if different libc versions coexist on the system. --- a/locale/newlocale.c +++ b/locale/newlocale.c @@ -30,6 +30,7 @@ /* Lock for protecting global data. */ __libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden) +extern error_t compute_locale_search_path (char **, size_t *); /* Use this when we come along an error. */ #define ERROR_RETURN \ @@ -48,7 +49,6 @@ __newlocale (int category_mask, const char *locale, __locale_t base) __locale_t result_ptr; char *locale_pat
aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/mcrypt-CVE-2012-4426.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/mcrypt-CVE-2012-4426.patch')
0 files changed, 0 insertions, 0 deletions
nu.org>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + + +error_t +__argz_suffix_entries (char **argz, size_t *argz_len, const char *suffix) + +{ + size_t suffix_len = strlen (suffix); + size_t count = __argz_count (*argz, *argz_len); + size_t new_argz_len = *argz_len + count * suffix_len; + char *new_argz = malloc (new_argz_len); + + if (new_argz) + { + char *p = new_argz, *entry; + + for (entry = *argz; + entry != NULL; + entry = argz_next (*argz, *argz_len, entry)) + { + p = stpcpy (p, entry); + p = stpcpy (p, suffix); + p++; + } + + free (*argz); + *argz = new_argz; + *argz_len = new_argz_len; + + return 0; + } + else + return ENOMEM; +} +weak_alias (__argz_suffix_entries, argz_suffix_entries) diff --git a/string/argz.h b/string/argz.h index bb62a31..d276a35 100644 --- a/string/argz.h +++ b/string/argz.h @@ -134,6 +134,16 @@ extern error_t argz_replace (char **__restrict __argz, const char *__restrict __str, const char *__restrict __with, unsigned int *__restrict __replace_count); + +/* Suffix each entry of ARGZ & ARGZ_LEN with SUFFIX. Return 0 on success, + and ENOMEN if memory cannot be allocated. */ +extern error_t __argz_suffix_entries (char **__restrict __argz, + size_t *__restrict __argz_len, + const char *__restrict __suffix); +extern error_t argz_suffix_entries (char **__restrict __argz, + size_t *__restrict __argz_len, + const char *__restrict __suffix); + /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there are no more. If entry is NULL, then the first entry is returned. This