summaryrefslogtreecommitdiff
path: root/lib/libXt
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2013-05-23 22:42:16 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2013-05-23 22:42:16 +0000
commit07bbac7e9578f69cff30a142ddc328e73150e927 (patch)
tree5969cd791a8db0ac08a76c652f7692e8f6ee50fc /lib/libXt
parent428eabf70e7336aacef2ce4a15926d6a63478b2c (diff)
Merge upstream fixes for several X libs vulnerabilities
discovered by Ilja van Sprundel. CVE-2013-1981 X.org libX11 1.5.99.901 (1.6 RC1) integer overflows CVE-2013-1982 X.org libXext 1.3.1 integer overflows CVE-2013-1983 X.org libXfixes 5.0 integer overflows CVE-2013-1984 X.org libXi 1.7.1 integer overflows CVE-2013-1985 X.org libXinerama 1.1.2 integer overflows CVE-2013-1986 X.org libXrandr 1.4.0 integer overflows CVE-2013-1987 X.org libXrender 0.9.7 integer overflows CVE-2013-1988 X.org libXRes 1.0.6 integer overflows CVE-2013-1989 X.org libXv 1.0.7 integer overflows CVE-2013-1990 X.org libXvMC 1.0.7 integer overflows CVE-2013-1991 X.org libXxf86dga 1.1.3 integer overflows CVE-2013-1992 X.org libdmx 1.1.2 integer overflows CVE-2013-1994 X.org libchromeXvMC & libchromeXvMCPro in openChrome 0.3.2 integer overflows CVE-2013-1995 X.org libXi 1.7.1 sign extension issues CVE-2013-1996 X.org libFS 1.0.4 sign extension issues CVE-2013-1997 X.org libX11 1.5.99.901 (1.6 RC1) buffer overflows CVE-2013-1998 X.org libXi 1.7.1 buffer overflows CVE-2013-1999 X.org libXvMC 1.0.7 buffer overflows CVE-2013-2000 X.org libXxf86dga 1.1.3 buffer overflows CVE-2013-2001 X.org libXxf86vm 1.1.2 buffer overflows CVE-2013-2002 X.org libXt 1.1.3 buffer overflows CVE-2013-2003 X.org libXcursor 1.1.13 integer overflows CVE-2013-2004 X.org libX11 1.5.99.901 (1.6 RC1) unbounded recursion CVE-2013-2005 X.org libXt 1.1.3 memory corruption CVE-2013-2066 X.org libXv 1.0.7 buffer overflows
Diffstat (limited to 'lib/libXt')
-rw-r--r--lib/libXt/src/ResConfig.c41
-rw-r--r--lib/libXt/src/Selection.c84
2 files changed, 73 insertions, 52 deletions
diff --git a/lib/libXt/src/ResConfig.c b/lib/libXt/src/ResConfig.c
index 68da5364c..1f3edbed8 100644
--- a/lib/libXt/src/ResConfig.c
+++ b/lib/libXt/src/ResConfig.c
@@ -971,26 +971,37 @@ _XtResourceConfigurationEH (
* resource and value fields.
*/
if (data) {
+ char *data_end = data + nitems;
+ char *data_value;
+
resource_len = Strtoul ((void *)data, &data_ptr, 10);
- data_ptr++;
- data_ptr[resource_len] = '\0';
+ if (data_ptr != (char *) data) {
+ data_ptr++;
+ data_value = data_ptr + resource_len;
+ } else /* strtoul failed to convert a number */
+ data_ptr = data_value = NULL;
+
+ if (data_value > data_ptr && data_value < data_end) {
+ *data_value++ = '\0';
- resource = XtNewString (data_ptr);
- value = XtNewString (&data_ptr[resource_len + 1]);
+ resource = XtNewString (data_ptr);
+ value = XtNewString (data_value);
#ifdef DEBUG
- fprintf (stderr, "resource_len=%d\n",resource_len);
- fprintf (stderr, "resource = %s\t value = %s\n",
- resource, value);
+ fprintf (stderr, "resource_len=%d\n"
+ resource_len);
+ fprintf (stderr, "resource = %s\t value = %s\n",
+ resource, value);
#endif
- /*
- * descend the application widget tree and
- * apply the value to the appropriate widgets
- */
- _search_widget_tree (w, resource, value);
-
- XtFree (resource);
- XtFree (value);
+ /*
+ * descend the application widget tree and
+ * apply the value to the appropriate widgets
+ */
+ _search_widget_tree (w, resource, value);
+
+ XtFree (resource);
+ XtFree (value);
+ }
}
}
diff --git a/lib/libXt/src/Selection.c b/lib/libXt/src/Selection.c
index f35cb440c..4f59d7028 100644
--- a/lib/libXt/src/Selection.c
+++ b/lib/libXt/src/Selection.c
@@ -839,14 +839,16 @@ static void HandleSelectionEvents(
IndirectPair *p;
int format;
unsigned long bytesafter, length;
- unsigned char *value;
+ unsigned char *value = NULL;
ev.property = event->xselectionrequest.property;
StartProtectedSection(ev.display, ev.requestor);
- (void) XGetWindowProperty(ev.display, ev.requestor,
+ if (XGetWindowProperty(ev.display, ev.requestor,
event->xselectionrequest.property, 0L, 1000000,
False,(Atom)AnyPropertyType, &target, &format, &length,
- &bytesafter, &value);
- count = BYTELENGTH(length, format) / sizeof(IndirectPair);
+ &bytesafter, &value) == Success)
+ count = BYTELENGTH(length, format) / sizeof(IndirectPair);
+ else
+ count = 0;
for (p = (IndirectPair *)value; count; p++, count--) {
EndProtectedSection(ctx->dpy);
if (!GetConversion(ctx, (XSelectionRequestEvent*)event,
@@ -1053,9 +1055,10 @@ static Boolean IsINCRtype(
if (prop == None) return False;
- (void)XGetWindowProperty(XtDisplay(info->widget), window, prop, 0L, 0L,
- False, info->ctx->prop_list->incr_atom,
- &type, &format, &length, &bytesafter, &value);
+ if (XGetWindowProperty(XtDisplay(info->widget), window, prop, 0L, 0L,
+ False, info->ctx->prop_list->incr_atom, &type,
+ &format, &length, &bytesafter, &value) != Success)
+ return False;
return (type == info->ctx->prop_list->incr_atom);
}
@@ -1069,7 +1072,6 @@ static void ReqCleanup(
{
CallBackInfo info = (CallBackInfo)closure;
unsigned long bytesafter, length;
- char *value;
int format;
Atom target;
@@ -1093,17 +1095,19 @@ static void ReqCleanup(
(ev->xproperty.state == PropertyNewValue) &&
(ev->xproperty.atom == info->property)) {
XPropertyEvent *event = (XPropertyEvent *) ev;
- (void) XGetWindowProperty(event->display, XtWindow(widget),
- event->atom, 0L, 1000000, True, AnyPropertyType,
- &target, &format, &length, &bytesafter,
- (unsigned char **) &value);
- XFree(value);
- if (length == 0) {
- XtRemoveEventHandler(widget, (EventMask) PropertyChangeMask, FALSE,
- ReqCleanup, (XtPointer) info );
- FreeSelectionProperty(XtDisplay(widget), info->property);
- XtFree(info->value); /* requestor never got this, so free now */
- FreeInfo(info);
+ char *value = NULL;
+ if (XGetWindowProperty(event->display, XtWindow(widget),
+ event->atom, 0L, 1000000, True, AnyPropertyType,
+ &target, &format, &length, &bytesafter,
+ (unsigned char **) &value) == Success) {
+ XFree(value);
+ if (length == 0) {
+ XtRemoveEventHandler(widget, (EventMask) PropertyChangeMask,
+ FALSE, ReqCleanup, (XtPointer) info );
+ FreeSelectionProperty(XtDisplay(widget), info->property);
+ XtFree(info->value); /* requestor never got this, so free now */
+ FreeInfo(info);
+ }
}
}
}
@@ -1121,20 +1125,23 @@ static void ReqTimedOut(
unsigned long bytesafter;
unsigned long proplength;
Atom type;
- IndirectPair *pairs;
XtPointer *c;
int i;
if (*info->target == info->ctx->prop_list->indirect_atom) {
- (void) XGetWindowProperty(XtDisplay(info->widget),
- XtWindow(info->widget), info->property, 0L,
- 10000000, True, AnyPropertyType, &type, &format,
- &proplength, &bytesafter, (unsigned char **) &pairs);
- XFree((char*)pairs);
- for (proplength = proplength / IndirectPairWordSize, i = 0, c = info->req_closure;
- proplength; proplength--, c++, i++)
- (*info->callbacks[i])(info->widget, *c,
- &info->ctx->selection, &resulttype, value, &length, &format);
+ IndirectPair *pairs = NULL;
+ if (XGetWindowProperty(XtDisplay(info->widget), XtWindow(info->widget),
+ info->property, 0L, 10000000, True,
+ AnyPropertyType, &type, &format, &proplength,
+ &bytesafter, (unsigned char **) &pairs)
+ == Success) {
+ XFree(pairs);
+ for (proplength = proplength / IndirectPairWordSize, i = 0,
+ c = info->req_closure;
+ proplength; proplength--, c++, i++)
+ (*info->callbacks[i])(info->widget, *c, &info->ctx->selection,
+ &resulttype, value, &length, &format);
+ }
} else {
(*info->callbacks[0])(info->widget, *info->req_closure,
&info->ctx->selection, &resulttype, value, &length, &format);
@@ -1280,12 +1287,13 @@ Boolean HandleNormal(
unsigned long length;
int format;
Atom type;
- unsigned char *value;
+ unsigned char *value = NULL;
int number = info->current;
- (void) XGetWindowProperty(dpy, XtWindow(widget), property, 0L,
- 10000000, False, AnyPropertyType,
- &type, &format, &length, &bytesafter, &value);
+ if (XGetWindowProperty(dpy, XtWindow(widget), property, 0L, 10000000,
+ False, AnyPropertyType, &type, &format, &length,
+ &bytesafter, &value) != Success)
+ return FALSE;
if (type == info->ctx->prop_list->incr_atom) {
unsigned long size = IncrPropSize(widget, value, format, length);
@@ -1370,7 +1378,6 @@ static void HandleSelectionReplies(
Display *dpy = event->display;
CallBackInfo info = (CallBackInfo) closure;
Select ctx = info->ctx;
- IndirectPair *pairs, *p;
unsigned long bytesafter;
unsigned long length;
int format;
@@ -1385,9 +1392,12 @@ static void HandleSelectionReplies(
XtRemoveEventHandler(widget, (EventMask)0, TRUE,
HandleSelectionReplies, (XtPointer) info );
if (event->target == ctx->prop_list->indirect_atom) {
- (void) XGetWindowProperty(dpy, XtWindow(widget), info->property, 0L,
- 10000000, True, AnyPropertyType, &type, &format,
- &length, &bytesafter, (unsigned char **) &pairs);
+ IndirectPair *pairs = NULL, *p;
+ if (XGetWindowProperty(dpy, XtWindow(widget), info->property, 0L,
+ 10000000, True, AnyPropertyType, &type, &format,
+ &length, &bytesafter, (unsigned char **) &pairs)
+ != Success)
+ length = 0;
for (length = length / IndirectPairWordSize, p = pairs,
c = info->req_closure;
length; length--, p++, c++, info->current++) {