projects
/
platform
/
upstream
/
libXi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.7.2
[platform/upstream/libXi.git]
/
src
/
XGetProp.c
diff --git
a/src/XGetProp.c
b/src/XGetProp.c
index
c5d088b
..
8c69ef2
100644
(file)
--- a/
src/XGetProp.c
+++ b/
src/XGetProp.c
@@
-60,6
+60,7
@@
SOFTWARE.
#include <X11/extensions/XInput.h>
#include <X11/extensions/extutil.h>
#include "XIint.h"
#include <X11/extensions/XInput.h>
#include <X11/extensions/extutil.h>
#include "XIint.h"
+#include <limits.h>
XEventClass *
XGetDeviceDontPropagateList(
XEventClass *
XGetDeviceDontPropagateList(
@@
-68,7
+69,6
@@
XGetDeviceDontPropagateList(
int *count)
{
XEventClass *list = NULL;
int *count)
{
XEventClass *list = NULL;
- int rlen;
xGetDeviceDontPropagateListReq *req;
xGetDeviceDontPropagateListReply rep;
XExtDisplayInfo *info = XInput_find_display(dpy);
xGetDeviceDontPropagateListReq *req;
xGetDeviceDontPropagateListReply rep;
XExtDisplayInfo *info = XInput_find_display(dpy);
@@
-89,11
+89,11
@@
XGetDeviceDontPropagateList(
}
*count = rep.count;
}
*count = rep.count;
- if (
*count
) {
- rlen = rep.length << 2;
-
list = (XEventClass *)
Xmalloc(rep.length * sizeof(XEventClass));
+ if (
rep.length != 0
) {
+ if ((rep.count != 0) && (rep.length < (INT_MAX / sizeof(XEventClass))))
+
list =
Xmalloc(rep.length * sizeof(XEventClass));
if (list) {
if (list) {
- int i;
+
unsigned
int i;
CARD32 ec;
/* read and assign each XEventClass separately because
CARD32 ec;
/* read and assign each XEventClass separately because
@@
-104,8
+104,10
@@
XGetDeviceDontPropagateList(
_XRead(dpy, (char *)(&ec), sizeof(CARD32));
list[i] = (XEventClass) ec;
}
_XRead(dpy, (char *)(&ec), sizeof(CARD32));
list[i] = (XEventClass) ec;
}
- } else
- _XEatData(dpy, (unsigned long)rlen);
+ } else {
+ *count = 0;
+ _XEatDataWords(dpy, rep.length);
+ }
}
UnlockDisplay(dpy);
}
UnlockDisplay(dpy);