#include <X11/extensions/XInput.h>
#include <X11/extensions/extutil.h>
#include "XIint.h"
+#include <limits.h>
XEventClass *
XGetDeviceDontPropagateList(
int *count)
{
XEventClass *list = NULL;
- int rlen;
xGetDeviceDontPropagateListReq *req;
xGetDeviceDontPropagateListReply rep;
XExtDisplayInfo *info = XInput_find_display(dpy);
}
*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) {
- int i;
+ unsigned int i;
CARD32 ec;
/* read and assign each XEventClass separately because
_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);