Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-1.9.git;a=commitdiff;h=6022036384b799cb1e17fbb53efc91ed08022919

commit 6022036384b799cb1e17fbb53efc91ed08022919
Author: kikadf <[email protected]>
Date:   Thu Aug 28 10:39:45 2014 +0200

glibc-2.16.0-4arcturus1-x86_64

* Fix CVE-2014-0475, CVE-2014-5119

diff --git a/source/base/glibc/CVE-2014-0475.patch 
b/source/base/glibc/CVE-2014-0475.patch
new file mode 100644
index 0000000..b5a4c42
--- /dev/null
+++ b/source/base/glibc/CVE-2014-0475.patch
@@ -0,0 +1,123 @@
+From: Florian Weimer <[email protected]>
+Date: Mon, 12 May 2014 15:24:12 +0200
+Subject: [PATCH 2/3] _nl_find_locale: Improve handling of crafted locale names
+
+Index: eglibc-2.13/locale/findlocale.c
+===================================================================
+--- eglibc-2.13.orig/locale/findlocale.c       2010-01-26 12:27:38.000000000 
+0100
++++ eglibc-2.13/locale/findlocale.c    2014-07-08 20:57:26.329498374 +0200
+@@ -18,6 +18,7 @@
+    02111-1307 USA.  */
+
+ #include <assert.h>
++#include <errno.h>
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -58,6 +59,45 @@
+
+ const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
+
++/* Checks if the name is actually present, that is, not NULL and not
++   empty.  */
++static inline int
++name_present (const char *name)
++{
++  return name != NULL && name[0] != '\0';
++}
++
++/* Checks that the locale name neither extremely long, nor contains a
++   ".." path component (to prevent directory traversal).  */
++static inline int
++valid_locale_name (const char *name)
++{
++  /* Not set.  */
++  size_t namelen = strlen (name);
++  /* Name too long.  The limit is arbitrary and prevents stack overflow
++     issues later.  */
++  if (__glibc_unlikely (namelen > 255))
++    return 0;
++  /* Directory traversal attempt.  */
++  static const char slashdot[4] = {'/', '.', '.', '/'};
++  if (__glibc_unlikely (memmem (name, namelen,
++                              slashdot, sizeof (slashdot)) != NULL))
++    return 0;
++  if (namelen == 2 && __glibc_unlikely (name[0] == '.' && name [1] == '.'))
++    return 0;
++  if (namelen >= 3
++      && __glibc_unlikely (((name[0] == '.'
++                           && name[1] == '.'
++                           && name[2] == '/')
++                          || (name[namelen - 3] == '/'
++                              && name[namelen - 2] == '.'
++                              && name[namelen - 1] == '.'))))
++    return 0;
++  /* If there is a slash in the name, it must start with one.  */
++  if (__glibc_unlikely (memchr (name, '/', namelen) != NULL) && name[0] != 
'/')
++    return 0;
++  return 1;
++}
+
+ struct __locale_data *
+ internal_function
+@@ -66,7 +106,7 @@
+ {
+   int mask;
+   /* Name of the locale for this category.  */
+-  char *loc_name;
++  char *loc_name = (char *) *name;
+   const char *language;
+   const char *modifier;
+   const char *territory;
+@@ -74,31 +114,39 @@
+   const char *normalized_codeset;
+   struct loaded_l10nfile *locale_file;
+
+-  if ((*name)[0] == '\0')
++  if (loc_name[0] == '\0')
+     {
+       /* The user decides which locale to use by setting environment
+        variables.  */
+-      *name = getenv ("LC_ALL");
+-      if (*name == NULL || (*name)[0] == '\0')
+-      *name = getenv (_nl_category_names.str
++      loc_name = getenv ("LC_ALL");
++      if (!name_present (loc_name))
++      loc_name = getenv (_nl_category_names.str
+                       + _nl_category_name_idxs[category]);
+-      if (*name == NULL || (*name)[0] == '\0')
+-      *name = getenv ("LANG");
++      if (!name_present (loc_name))
++      loc_name = getenv ("LANG");
++      if (!name_present (loc_name))
++      loc_name = (char *) _nl_C_name;
+     }
+
+-  if (*name == NULL || (*name)[0] == '\0'
+-      || (__builtin_expect (__libc_enable_secure, 0)
+-        && strchr (*name, '/') != NULL))
+-    *name = (char *) _nl_C_name;
++  /* We used to fall back to the C locale if the name contains a slash
++     character '/', but we now check for directory traversal in
++     valid_locale_name, so this is no longer necessary.  */
+
+-  if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
+-      || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
++  if (__builtin_expect (strcmp (loc_name, _nl_C_name), 1) == 0
++      || __builtin_expect (strcmp (loc_name, _nl_POSIX_name), 1) == 0)
+     {
+       /* We need not load anything.  The needed data is contained in
+        the library itself.  */
+       *name = (char *) _nl_C_name;
+       return _nl_C[category];
+     }
++  else if (!valid_locale_name (loc_name))
++    {
++      __set_errno (EINVAL);
++      return NULL;
++    }
++
++  *name = loc_name;
+
+   /* We really have to load some data.  First we try the archive,
+      but only if there was no LOCPATH environment variable specified.  */
diff --git a/source/base/glibc/CVE-2014-5119.patch 
b/source/base/glibc/CVE-2014-5119.patch
new file mode 100644
index 0000000..89f35c0
--- /dev/null
+++ b/source/base/glibc/CVE-2014-5119.patch
@@ -0,0 +1,199 @@
+commit a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8
+Author: Florian Weimer <[email protected]>
+Date:   Tue Aug 26 19:38:59 2014 +0200
+
+    __gconv_translit_find: Disable function [BZ #17187]
+
+    This functionality has never worked correctly, and the implementation
+    contained a security vulnerability (CVE-2014-5119).
+
+diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
+index 1e25854..e0835fc 100644
+--- a/iconv/gconv_trans.c
++++ b/iconv/gconv_trans.c
+@@ -242,181 +242,12 @@ __gconv_transliterate (struct __gconv_step *step,
+   return __GCONV_ILLEGAL_INPUT;
+ }
+
+-
+-/* Structure to represent results of found (or not) transliteration
+-   modules.  */
+-struct known_trans
+-{
+-  /* This structure must remain the first member.  */
+-  struct trans_struct info;
+-
+-  char *fname;
+-  void *handle;
+-  int open_count;
+-};
+-
+-
+-/* Tree with results of previous calls to __gconv_translit_find.  */
+-static void *search_tree;
+-
+-/* We modify global data.   */
+-__libc_lock_define_initialized (static, lock);
+-
+-
+-/* Compare two transliteration entries.  */
+-static int
+-trans_compare (const void *p1, const void *p2)
+-{
+-  const struct known_trans *s1 = (const struct known_trans *) p1;
+-  const struct known_trans *s2 = (const struct known_trans *) p2;
+-
+-  return strcmp (s1->info.name, s2->info.name);
+-}
+-
+-
+-/* Open (maybe reopen) the module named in the struct.  Get the function
+-   and data structure pointers we need.  */
+-static int
+-open_translit (struct known_trans *trans)
+-{
+-  __gconv_trans_query_fct queryfct;
+-
+-  trans->handle = __libc_dlopen (trans->fname);
+-  if (trans->handle == NULL)
+-    /* Not available.  */
+-    return 1;
+-
+-  /* Find the required symbol.  */
+-  queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
+-  if (queryfct == NULL)
+-    {
+-      /* We cannot live with that.  */
+-    close_and_out:
+-      __libc_dlclose (trans->handle);
+-      trans->handle = NULL;
+-      return 1;
+-    }
+-
+-  /* Get the context.  */
+-  if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
+-      != 0)
+-    goto close_and_out;
+-
+-  /* Of course we also have to have the actual function.  */
+-  trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
+-  if (trans->info.trans_fct == NULL)
+-    goto close_and_out;
+-
+-  /* Now the optional functions.  */
+-  trans->info.trans_init_fct =
+-    __libc_dlsym (trans->handle, "gconv_trans_init");
+-  trans->info.trans_context_fct =
+-    __libc_dlsym (trans->handle, "gconv_trans_context");
+-  trans->info.trans_end_fct =
+-    __libc_dlsym (trans->handle, "gconv_trans_end");
+-
+-  trans->open_count = 1;
+-
+-  return 0;
+-}
+-
+-
+ int
+ internal_function
+ __gconv_translit_find (struct trans_struct *trans)
+ {
+-  struct known_trans **found;
+-  const struct path_elem *runp;
+-  int res = 1;
+-
+-  /* We have to have a name.  */
+-  assert (trans->name != NULL);
+-
+-  /* Acquire the lock.  */
+-  __libc_lock_lock (lock);
+-
+-  /* See whether we know this module already.  */
+-  found = __tfind (trans, &search_tree, trans_compare);
+-  if (found != NULL)
+-    {
+-      /* Is this module available?  */
+-      if ((*found)->handle != NULL)
+-      {
+-        /* Maybe we have to reopen the file.  */
+-        if ((*found)->handle != (void *) -1)
+-          /* The object is not unloaded.  */
+-          res = 0;
+-        else if (open_translit (*found) == 0)
+-          {
+-            /* Copy the data.  */
+-            *trans = (*found)->info;
+-            (*found)->open_count++;
+-            res = 0;
+-          }
+-      }
+-    }
+-  else
+-    {
+-      size_t name_len = strlen (trans->name) + 1;
+-      int need_so = 0;
+-      struct known_trans *newp;
+-
+-      /* We have to continue looking for the module.  */
+-      if (__gconv_path_elem == NULL)
+-      __gconv_get_path ();
+-
+-      /* See whether we have to append .so.  */
+-      if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
+-      need_so = 1;
+-
+-      /* Create a new entry.  */
+-      newp = (struct known_trans *) malloc (sizeof (struct known_trans)
+-                                          + (__gconv_max_path_elem_len
+-                                             + name_len + 3)
+-                                          + name_len);
+-      if (newp != NULL)
+-      {
+-        char *cp;
+-
+-        /* Clear the struct.  */
+-        memset (newp, '\0', sizeof (struct known_trans));
+-
+-        /* Store a copy of the module name.  */
+-        newp->info.name = cp = (char *) (newp + 1);
+-        cp = __mempcpy (cp, trans->name, name_len);
+-
+-        newp->fname = cp;
+-
+-        /* Search in all the directories.  */
+-        for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
+-          {
+-            cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
+-                            trans->name, name_len);
+-            if (need_so)
+-              memcpy (cp, ".so", sizeof (".so"));
+-
+-            if (open_translit (newp) == 0)
+-              {
+-                /* We found a module.  */
+-                res = 0;
+-                break;
+-              }
+-          }
+-
+-        if (res)
+-          newp->fname = NULL;
+-
+-        /* In any case we'll add the entry to our search tree.  */
+-        if (__tsearch (newp, &search_tree, trans_compare) == NULL)
+-          {
+-            /* Yickes, this should not happen.  Unload the object.  */
+-            res = 1;
+-            /* XXX unload here.  */
+-          }
+-      }
+-    }
+-
+-  __libc_lock_unlock (lock);
+-
+-  return res;
++  /* Transliteration module loading has been removed because it never
++     worked as intended and suffered from a security vulnerability.
++     Consequently, this function always fails.  */
++  return 1;
+ }
diff --git a/source/base/glibc/FrugalBuild b/source/base/glibc/FrugalBuild
index 4889cbb..a67ab6e 100644
--- a/source/base/glibc/FrugalBuild
+++ b/source/base/glibc/FrugalBuild
@@ -11,7 +11,7 @@ USE_GLIBC_PORTS=${USE_GLIBC_PORTS:-$USE_GLIBC_PORTS_DEFAULT}

pkgname=glibc
pkgver=2.16.0
-pkgrel=3
+pkgrel=4arcturus1
pkgdesc="GNU C Library"
url="http://www.gnu.org/software/libc/libc.html";
depends=()
@@ -37,6 +37,11 @@ if Fuse GLIBC_PORTS; then
signatures=("${signatures[@]}" $_dlurl/glibc-ports-$pkgver.tar.xz.sig '')
fi

+# FSA fix ***
+source=(${source[@]} CVE-2014-0475.patch  CVE-2014-5119.patch)
+signatures=(${signatures[@]} '' '')
+# ***********
+
build()
{
Fcd $pkgname-$pkgver
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to