author | Alan Coopersmith <Alan.Coopersmith@Oracle.COM> |
Wed, 15 May 2013 13:44:02 -0700 | |
changeset 1345 | d5dacbb8de2b |
permissions | -rw-r--r-- |
1345
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
1 |
From e13eef2d952fdc082f76f66bebe6cee08c5144ab Mon Sep 17 00:00:00 2001 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
2 |
From: Alan Coopersmith <[email protected]> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
3 |
Date: Fri, 26 Apr 2013 16:31:58 -0700 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
4 |
Subject: [PATCH:mesa 1/2] integer overflow in XF86DRIOpenConnection() |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
5 |
[CVE-2013-1993 1/2] |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
6 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
7 |
busIdStringLength is a CARD32 and needs to be bounds checked before adding |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
8 |
one to it to come up with the total size to allocate, to avoid integer |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
9 |
overflow leading to underallocation and writing data from the network past |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
10 |
the end of the allocated buffer. |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
11 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
12 |
Reported-by: Ilja Van Sprundel <[email protected]> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
13 |
Signed-off-by: Alan Coopersmith <[email protected]> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
14 |
--- |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
15 |
src/glx/XF86dri.c | 7 ++++++- |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
16 |
1 file changed, 6 insertions(+), 1 deletion(-) |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
17 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
18 |
diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
19 |
index b1cdc9b..8f53bd7 100644 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
20 |
--- a/src/glx/XF86dri.c |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
21 |
+++ b/src/glx/XF86dri.c |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
22 |
@@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
23 |
#include <X11/extensions/Xext.h> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
24 |
#include <X11/extensions/extutil.h> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
25 |
#include "xf86dristr.h" |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
26 |
+#include <limits.h> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
27 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
28 |
static XExtensionInfo _xf86dri_info_data; |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
29 |
static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
30 |
@@ -201,7 +202,11 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
31 |
} |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
32 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
33 |
if (rep.length) { |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
34 |
- if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) { |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
35 |
+ if (rep.busIdStringLength < INT_MAX) |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
36 |
+ *busIdString = calloc(rep.busIdStringLength + 1, 1); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
37 |
+ else |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
38 |
+ *busIdString = NULL; |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
39 |
+ if (*busIdString == NULL) { |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
40 |
_XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
41 |
UnlockDisplay(dpy); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
42 |
SyncHandle(); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
43 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
44 |
-- |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
45 |
1.7.9.2 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
46 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
47 |
From 166bdb02bbbe73c11bc4b96a29f277695f4ae495 Mon Sep 17 00:00:00 2001 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
48 |
From: Alan Coopersmith <[email protected]> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
49 |
Date: Fri, 26 Apr 2013 16:33:03 -0700 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
50 |
Subject: [PATCH:mesa 2/2] integer overflow in XF86DRIGetClientDriverName() |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
51 |
[CVE-2013-1993 2/2] |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
52 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
53 |
clientDriverNameLength is a CARD32 and needs to be bounds checked before |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
54 |
adding one to it to come up with the total size to allocate, to avoid |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
55 |
integer overflow leading to underallocation and writing data from the |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
56 |
network past the end of the allocated buffer. |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
57 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
58 |
Reported-by: Ilja Van Sprundel <[email protected]> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
59 |
Signed-off-by: Alan Coopersmith <[email protected]> |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
60 |
--- |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
61 |
src/glx/XF86dri.c | 8 +++++--- |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
62 |
1 file changed, 5 insertions(+), 3 deletions(-) |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
63 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
64 |
diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
65 |
index 8f53bd7..56e3557 100644 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
66 |
--- a/src/glx/XF86dri.c |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
67 |
+++ b/src/glx/XF86dri.c |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
68 |
@@ -305,9 +305,11 @@ XF86DRIGetClientDriverName(Display * dpy, int screen, |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
69 |
*ddxDriverPatchVersion = rep.ddxDriverPatchVersion; |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
70 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
71 |
if (rep.length) { |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
72 |
- if (! |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
73 |
- (*clientDriverName = |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
74 |
- (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) { |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
75 |
+ if (rep.clientDriverNameLength < INT_MAX) |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
76 |
+ *clientDriverName = calloc(rep.clientDriverNameLength + 1, 1); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
77 |
+ else |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
78 |
+ *clientDriverName = NULL; |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
79 |
+ if (*clientDriverName == NULL) { |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
80 |
_XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
81 |
UnlockDisplay(dpy); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
82 |
SyncHandle(); |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
83 |
|
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
84 |
-- |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
85 |
1.7.9.2 |
d5dacbb8de2b
16673783 problem in X11/LIBRARIES
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
86 |