Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=dex77stuff.git;a=commitdiff;h=90036033eed9cb1a060cba4b02cce8515d07c0e8

commit 90036033eed9cb1a060cba4b02cce8515d07c0e8
Author: kikadf <[email protected]>
Date:   Thu Feb 26 12:12:26 2015 +0100

glibc-2.19-5-x86_64

* Fix CVE-2012-3406, CVE-2014-9402, CVE-2015-1472, CVE-2015-1473

diff --git a/source/base/glibc/CVE-2012-3406.patch 
b/source/base/glibc/CVE-2012-3406.patch
new file mode 100644
index 0000000..6a11301
--- /dev/null
+++ b/source/base/glibc/CVE-2012-3406.patch
@@ -0,0 +1,255 @@
+2014-12-15  Jeff Law  <[email protected]>
+
+       [BZ #16617]
+       * stdio-common/vfprintf.c (vfprintf): Allocate large specs array
+       on the heap.  (CVE-2012-3406)
+       * stdio-common/bug23-2.c, stdio-common/bug23-3.c: New file.
+       * stdio-common/bug23-4.c: New file.  Test case by Joseph Myers.
+       * stdio-common/Makefile (tests): Add bug23-2, bug23-3, bug23-4.
+
+--- a/stdio-common/Makefile
++++ b/stdio-common/Makefile
+@@ -57,7 +57,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
+        bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
+        scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
+        bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
+-       bug25 tst-printf-round bug26
++       bug25 tst-printf-round bug23-2 bug23-3 bug23-4
+
+ test-srcs = tst-unbputc tst-printf
+
+--- /dev/null
++++ b/stdio-common/bug23-2.c
+@@ -0,0 +1,70 @@
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
++
++static const char expected[] = "\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55\
++\n\
++a\n\
++abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
++
++static int
++do_test (void)
++{
++  char *buf = malloc (strlen (expected) + 1);
++  snprintf (buf, strlen (expected) + 1,
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++          "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
++          "a", "b", "c", "d", 5);
++  return strcmp (buf, expected) != 0;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+--- /dev/null
++++ b/stdio-common/bug23-3.c
+@@ -0,0 +1,50 @@
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
++
++int
++do_test (void)
++{
++  size_t instances = 16384;
++#define X0 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
++  const char *item = "\na\nabbcd55";
++#define X3 X0 X0 X0 X0 X0 X0 X0 X0
++#define X6 X3 X3 X3 X3 X3 X3 X3 X3
++#define X9 X6 X6 X6 X6 X6 X6 X6 X6
++#define X12 X9 X9 X9 X9 X9 X9 X9 X9
++#define X14 X12 X12 X12 X12
++#define TRAILER "%%%%%%%%%%%%%%%%%%%%%%%%%%"
++#define TRAILER2 TRAILER TRAILER
++  size_t length = instances * strlen (item) + strlen (TRAILER) + 1;
++
++  char *buf = malloc (length + 1);
++  snprintf (buf, length + 1,
++          X14 TRAILER2 "\n",
++          "a", "b", "c", "d", 5);
++
++  const char *p = buf;
++  size_t i;
++  for (i = 0; i < instances; ++i)
++    {
++      const char *expected;
++      for (expected = item; *expected; ++expected)
++      {
++        if (*p != *expected)
++          {
++            printf ("mismatch at offset %zu (%zu): expected %d, got %d\n",
++                    (size_t) (p - buf), i, *expected & 0xFF, *p & 0xFF);
++            return 1;
++          }
++        ++p;
++      }
++    }
++  if (strcmp (p, TRAILER "\n") != 0)
++    {
++      printf ("mismatch at trailer: [%s]\n", p);
++      return 1;
++    }
++  free (buf);
++  return 0;
++}
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+--- /dev/null
++++ b/stdio-common/bug23-4.c
+@@ -0,0 +1,31 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/resource.h>
++
++#define LIMIT 1000000
++
++int
++main (void)
++{
++  struct rlimit lim;
++  getrlimit (RLIMIT_STACK, &lim);
++  lim.rlim_cur = 1048576;
++  setrlimit (RLIMIT_STACK, &lim);
++  char *fmtstr = malloc (4 * LIMIT + 1);
++  if (fmtstr == NULL)
++    abort ();
++  char *output = malloc (LIMIT + 1);
++  if (output == NULL)
++    abort ();
++  for (size_t i = 0; i < LIMIT; i++)
++    memcpy (fmtstr + 4 * i, "%1$d", 4);
++  fmtstr[4 * LIMIT] = '\0';
++  int ret = snprintf (output, LIMIT + 1, fmtstr, 0);
++  if (ret != LIMIT)
++    abort ();
++  for (size_t i = 0; i < LIMIT; i++)
++    if (output[i] != '0')
++      abort ();
++  return 0;
++}
+--- a/stdio-common/vfprintf.c
++++ b/stdio-common/vfprintf.c
+@@ -263,6 +263,12 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
+   /* For the argument descriptions, which may be allocated on the heap.  */
+   void *args_malloced = NULL;
+
++  /* For positional argument handling.  */
++  struct printf_spec *specs;
++
++  /* Track if we malloced the SPECS array and thus must free it.  */
++  bool specs_malloced = false;
++
+   /* This table maps a character into a number representing a
+      class.  In each step there is a destination label for each
+      class.  */
+@@ -1679,8 +1685,8 @@ do_positional:
+     size_t nspecs = 0;
+     /* A more or less arbitrary start value.  */
+     size_t nspecs_size = 32 * sizeof (struct printf_spec);
+-    struct printf_spec *specs = alloca (nspecs_size);
+
++    specs = alloca (nspecs_size);
+     /* The number of arguments the format string requests.  This will
+        determine the size of the array needed to store the argument
+        attributes.  */
+@@ -1721,11 +1727,39 @@ do_positional:
+       if (nspecs * sizeof (*specs) >= nspecs_size)
+         {
+           /* Extend the array of format specifiers.  */
++          if (nspecs_size * 2 < nspecs_size)
++            {
++              __set_errno (ENOMEM);
++              done = -1;
++              goto all_done;
++            }
+           struct printf_spec *old = specs;
+-          specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
++          if (__libc_use_alloca (2 * nspecs_size))
++            specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
++          else
++            {
++              nspecs_size *= 2;
++              specs = malloc (nspecs_size);
++              if (specs == NULL)
++                {
++                  __set_errno (ENOMEM);
++                  specs = old;
++                  done = -1;
++                  goto all_done;
++                }
++            }
+
+           /* Copy the old array's elements to the new space.  */
+           memmove (specs, old, nspecs * sizeof (*specs));
++
++          /* If we had previously malloc'd space for SPECS, then
++             release it after the copy is complete.  */
++          if (specs_malloced)
++            free (old);
++
++          /* Now set SPECS_MALLOCED if needed.  */
++          if (!__libc_use_alloca (nspecs_size))
++            specs_malloced = true;
+         }
+
+       /* Parse the format specifier.  */
+@@ -2046,6 +2080,8 @@ do_positional:
+   }
+
+ all_done:
++  if (specs_malloced)
++    free (specs);
+   if (__glibc_unlikely (args_malloced != NULL))
+     free (args_malloced);
+   if (__glibc_unlikely (workstart != NULL))
diff --git a/source/base/glibc/CVE-2014-9402.patch 
b/source/base/glibc/CVE-2014-9402.patch
new file mode 100644
index 0000000..7973851
--- /dev/null
+++ b/source/base/glibc/CVE-2014-9402.patch
@@ -0,0 +1,19 @@
+2014-12-16  Florian Weimer  <[email protected]>
+
+       [BZ #17630]
+       * resolv/nss_dns/dns-network.c (getanswer_r): Iterate over alias
+       names.
+
+--- a/resolv/nss_dns/dns-network.c
++++ b/resolv/nss_dns/dns-network.c
+@@ -398,8 +398,8 @@ getanswer_r (const querybuf *answer, int anslen, struct 
netent *result,
+
+       case BYNAME:
+         {
+-          char **ap = result->n_aliases++;
+-          while (*ap != NULL)
++          char **ap;
++          for (ap = result->n_aliases; *ap != NULL; ++ap)
+             {
+               /* Check each alias name for being of the forms:
+                  4.3.2.1.in-addr.arpa         = net 1.2.3.4
diff --git a/source/base/glibc/CVE-2015-1472-1473.patch 
b/source/base/glibc/CVE-2015-1472-1473.patch
new file mode 100644
index 0000000..8fa475c
--- /dev/null
+++ b/source/base/glibc/CVE-2015-1472-1473.patch
@@ -0,0 +1,82 @@
+2015-02-05  Paul Pluzhnikov  <[email protected]>
+
+       [BZ #16618]
+       * stdio-common/tst-sscanf.c (main): Test for buffer overflow.
+       * stdio-common/vfscanf.c (_IO_vfscanf_internal): Compute needed
+       size in bytes. Store needed elements in wpmax. Use needed size
+       in bytes for extend_alloca.
+
+--- a/stdio-common/tst-sscanf.c
++++ b/stdio-common/tst-sscanf.c
+@@ -232,5 +232,38 @@
+       }
+     }
+
++  /* BZ #16618
++     The test will segfault during SSCANF if the buffer overflow
++     is not fixed.  The size of `s` is such that it forces the use
++     of malloc internally and this triggers the incorrect computation.
++     Thus the value for SIZE is arbitrariy high enough that malloc
++     is used.  */
++  {
++#define SIZE 131072
++    CHAR *s = malloc ((SIZE + 1) * sizeof (*s));
++    if (s == NULL)
++      abort ();
++    for (size_t i = 0; i < SIZE; i++)
++      s[i] = L('0');
++    s[SIZE] = L('\0');
++    int i = 42;
++    /* Scan multi-digit zero into `i`.  */
++    if (SSCANF (s, L("%d"), &i) != 1)
++      {
++      printf ("FAIL: bug16618: SSCANF did not read one input item.\n");
++      result = 1;
++      }
++    if (i != 0)
++      {
++      printf ("FAIL: bug16618: Value of `i` was not zero as expected.\n");
++      result = 1;
++      }
++    free (s);
++    if (result != 1)
++      printf ("PASS: bug16618: Did not crash.\n");
++#undef SIZE
++  }
++
++
+   return result;
+ }
+--- a/stdio-common/vfscanf.c
++++ b/stdio-common/vfscanf.c
+@@ -272,9 +272,10 @@
+       if (__builtin_expect (wpsize == wpmax, 0))                          \
+       {                                                                   \
+         CHAR_T *old = wp;                                                 \
+-        size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax                       \
+-                          ? UCHAR_MAX + 1 : 2 * wpmax);                   \
+-        if (use_malloc || !__libc_use_alloca (newsize))                   \
++        bool fits = __glibc_likely (wpmax <= SIZE_MAX / sizeof (CHAR_T) / 2); 
\
++        size_t wpneed = MAX (UCHAR_MAX + 1, 2 * wpmax);                   \
++        size_t newsize = fits ? wpneed * sizeof (CHAR_T) : SIZE_MAX;      \
++        if (!__libc_use_alloca (newsize))                                 \
+           {                                                               \
+             wp = realloc (use_malloc ? wp : NULL, newsize);               \
+             if (wp == NULL)                                               \
+@@ -286,14 +287,13 @@
+               }                                                           \
+             if (! use_malloc)                                             \
+               MEMCPY (wp, old, wpsize);                                   \
+-            wpmax = newsize;                                              \
++            wpmax = wpneed;                                               \
+             use_malloc = true;                                            \
+           }                                                               \
+         else                                                              \
+           {                                                               \
+             size_t s = wpmax * sizeof (CHAR_T);                           \
+-            wp = (CHAR_T *) extend_alloca (wp, s,                         \
+-                                           newsize * sizeof (CHAR_T));    \
++            wp = (CHAR_T *) extend_alloca (wp, s, newsize);               \
+             wpmax = s / sizeof (CHAR_T);                                  \
+             if (old != NULL)                                              \
+               MEMCPY (wp, old, wpsize);                                   \
diff --git a/source/base/glibc/FrugalBuild b/source/base/glibc/FrugalBuild
index a324040..9741366 100644
--- a/source/base/glibc/FrugalBuild
+++ b/source/base/glibc/FrugalBuild
@@ -4,7 +4,7 @@

pkgname=glibc
pkgver=2.19
-pkgrel=4
+pkgrel=5
pkgdesc="GNU C Library"
url="http://www.gnu.org/software/libc/libc.html";
depends=()
@@ -21,8 +21,9 @@ signatures=($_dlurl/glibc-$pkgver.tar.xz.sig)

# FSA fix ***
source=(${source[@]} CVE-2014-0475.patch CVE-2014-5119.patch CVE-2014-4043.patch
-                     CVE-2014-6040.patch CVE-2014-7817.patch)
-signatures=(${signatures[@]} '' '' '' '' '')
+                     CVE-2014-6040.patch CVE-2014-7817.patch 
CVE-2012-3406.patch
+                     CVE-2014-9402.patch CVE-2015-1472-1473.patch)
+signatures=(${signatures[@]} '' '' '' '' '' '' '' '')
# ***********

_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to