~ubuntu-branches/ubuntu/lucid/eglibc/lucid-security

« back to all changes in this revision

Viewing changes to debian/patches/any/CVE-2013-4332-part2.diff

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2014-07-28 11:23:55 UTC
  • Revision ID: package-import@ubuntu.com-20140728112355-d1m3idnt2n38dzj1
Tags: 2.11.1-0ubuntu7.14
* SECURITY UPDATE: denial of service via buffer overflow in getaddrinfo
  - debian/patches/CVE-2013-4357.patch: fix overflow in include/alloca.h,
    nis/nss_nis/nis-alias.c, nscd/nscd_getserv_r.c, posix/glob.c,
    sysdeps/posix/getaddrinfo.c.
  - CVE-2013-4357
* SECURITY UPDATE: denial of service via buffer overflow in getaddrinfo
  - debian/patches/any/CVE-2013-4458.patch: fix overflow in
    sysdeps/posix/getaddrinfo.c.
  - CVE-2013-4458
* SECURITY UPDATE: Directory traversal in locale environment handling
  - debian/patches/any/CVE-2014-0475.diff: validate locale names in
    locale/findlocale.c, locale/setlocale.c, added test to
    localedata/tst-setlocale3.c, localedata/Makefile.
  - CVE-2014-0475
* SECURITY UPDATE: use-after-free via posix_spawn_file_actions_addopen
  failing to copy the path argument
  - debian/patches/any/CVE-2014-4043.diff: properly copy path in
    posix/spawn_faction_addopen.c, posix/spawn_faction_destroy.c,
    posix/spawn_int.h, added test to posix/tst-spawn.c.
  - CVE-2014-4043
* debian/patches/any/CVE-2013-4237-part2.diff: fix alignment issue
  causing a readdir regression on sparc.
* debian/patches/any/CVE-2013-4332-part2.diff: added a couple of extra
  commits to fix another overflow and an infinite loop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: fix another overflow and an infinite loop
 
2
Origin: backport, https://sourceware.org/git/?p=glibc.git;h=321e26847188300173a5dc0ca42c2ff7b9bf7a78
 
3
Origin: backport, https://sourceware.org/git/?p=glibc.git;h=a56ee40b176d0a3f47f2a7eb75208f2e3763c9fd
 
4
 
 
5
Index: eglibc-2.11.1/malloc/hooks.c
 
6
===================================================================
 
7
--- eglibc-2.11.1.orig/malloc/hooks.c   2014-07-28 10:57:53.517597728 -0400
 
8
+++ eglibc-2.11.1/malloc/hooks.c        2014-07-28 11:01:04.701596786 -0400
 
9
@@ -404,10 +404,21 @@
 
10
   if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes, NULL);
 
11
   if (alignment <  MINSIZE) alignment = MINSIZE;
 
12
 
 
13
-  if (bytes+1 == 0) {
 
14
-    MALLOC_FAILURE_ACTION;
 
15
-    return NULL;
 
16
-  }
 
17
+  /* If the alignment is greater than SIZE_MAX / 2 + 1 it cannot be a
 
18
+     power of 2 and will cause overflow in the check below.  */
 
19
+  if (alignment > SIZE_MAX / 2 + 1)
 
20
+    {
 
21
+      __set_errno (EINVAL);
 
22
+      return 0;
 
23
+    }
 
24
+
 
25
+  /* Check for overflow.  */
 
26
+  if (bytes > SIZE_MAX - alignment - MINSIZE)
 
27
+    {
 
28
+      __set_errno (ENOMEM);
 
29
+      return 0;
 
30
+    }
 
31
+
 
32
   checked_request2size(bytes+1, nb);
 
33
   (void)mutex_lock(&main_arena.mutex);
 
34
   mem = (top_check() >= 0) ? _int_memalign(&main_arena, alignment, bytes+1) :
 
35
Index: eglibc-2.11.1/malloc/malloc.c
 
36
===================================================================
 
37
--- eglibc-2.11.1.orig/malloc/malloc.c  2014-07-28 10:57:53.517597728 -0400
 
38
+++ eglibc-2.11.1/malloc/malloc.c       2014-07-28 10:57:53.513597728 -0400
 
39
@@ -3874,6 +3874,14 @@
 
40
   /* Otherwise, ensure that it is at least a minimum chunk size */
 
41
   if (alignment <  MINSIZE) alignment = MINSIZE;
 
42
 
 
43
+  /* If the alignment is greater than SIZE_MAX / 2 + 1 it cannot be a
 
44
+     power of 2 and will cause overflow in the check below.  */
 
45
+  if (alignment > SIZE_MAX / 2 + 1)
 
46
+    {
 
47
+      __set_errno (EINVAL);
 
48
+      return 0;
 
49
+    }
 
50
+
 
51
   /* Check for overflow.  */
 
52
   if (bytes > SIZE_MAX - alignment - MINSIZE)
 
53
     {