aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/Xi
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/Xi')
-rw-r--r--nx-X11/programs/Xserver/Xi/chgfctl.c8
-rw-r--r--nx-X11/programs/Xserver/Xi/chgkmap.c15
-rw-r--r--nx-X11/programs/Xserver/Xi/chgprop.c11
-rw-r--r--nx-X11/programs/Xserver/Xi/grabdev.c13
-rw-r--r--nx-X11/programs/Xserver/Xi/grabdevb.c11
-rw-r--r--nx-X11/programs/Xserver/Xi/grabdevk.c10
-rw-r--r--nx-X11/programs/Xserver/Xi/selectev.c12
-rw-r--r--nx-X11/programs/Xserver/Xi/sendexev.c15
8 files changed, 33 insertions, 62 deletions
diff --git a/nx-X11/programs/Xserver/Xi/chgfctl.c b/nx-X11/programs/Xserver/Xi/chgfctl.c
index c502db325..fe8bd1fac 100644
--- a/nx-X11/programs/Xserver/Xi/chgfctl.c
+++ b/nx-X11/programs/Xserver/Xi/chgfctl.c
@@ -506,7 +506,6 @@ ChangeStringFeedback (client, dev, mask, s, f)
xStringFeedbackCtl *f;
{
register char n;
- register long *p;
int i, j;
KeySym *syms, *sup_syms;
@@ -514,12 +513,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
if (client->swapped)
{
swaps(&f->length,n); /* swapped num_keysyms in calling proc */
- p = (long *) (syms);
- for (i=0; i<f->num_keysyms; i++)
- {
- swapl(p, n);
- p++;
- }
+ SwapLongs((CARD32 *) syms, f->num_keysyms);
}
if (f->num_keysyms > s->ctrl.max_symbols)
diff --git a/nx-X11/programs/Xserver/Xi/chgkmap.c b/nx-X11/programs/Xserver/Xi/chgkmap.c
index 6b2a15aa2..3df376d9a 100644
--- a/nx-X11/programs/Xserver/Xi/chgkmap.c
+++ b/nx-X11/programs/Xserver/Xi/chgkmap.c
@@ -83,19 +83,14 @@ SProcXChangeDeviceKeyMapping(client)
register ClientPtr client;
{
register char n;
- register long *p;
- register int i, count;
+ unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
- p = (long *) &stuff[1];
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
- for (i = 0; i < count; i++)
- {
- swapl(p, n);
- p++;
- }
+ REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
+ SwapLongs((CARD32 *) (&stuff[1]), count);
return(ProcXChangeDeviceKeyMapping(client));
}
@@ -112,10 +107,14 @@ ProcXChangeDeviceKeyMapping(client)
int ret;
unsigned len;
DeviceIntPtr dev;
+ unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
+ count = stuff->keyCodes * stuff->keySymsPerKeyCode;
+ REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
+
dev = LookupDeviceIntRec (stuff->deviceid);
if (dev == NULL)
{
diff --git a/nx-X11/programs/Xserver/Xi/chgprop.c b/nx-X11/programs/Xserver/Xi/chgprop.c
index 20c654e2f..6e345d554 100644
--- a/nx-X11/programs/Xserver/Xi/chgprop.c
+++ b/nx-X11/programs/Xserver/Xi/chgprop.c
@@ -85,20 +85,15 @@ SProcXChangeDeviceDontPropagateList(client)
register ClientPtr client;
{
register char n;
- register long *p;
- register int i;
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window, n);
swaps(&stuff->count, n);
- p = (long *) &stuff[1];
- for (i=0; i<stuff->count; i++)
- {
- swapl(p, n);
- p++;
- }
+ REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
+ stuff->count * sizeof(CARD32));
+ SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return(ProcXChangeDeviceDontPropagateList(client));
}
diff --git a/nx-X11/programs/Xserver/Xi/grabdev.c b/nx-X11/programs/Xserver/Xi/grabdev.c
index 3b124a0f4..21e920a35 100644
--- a/nx-X11/programs/Xserver/Xi/grabdev.c
+++ b/nx-X11/programs/Xserver/Xi/grabdev.c
@@ -87,8 +87,6 @@ SProcXGrabDevice(client)
register ClientPtr client;
{
register char n;
- register long *p;
- register int i;
REQUEST(xGrabDeviceReq);
swaps(&stuff->length, n);
@@ -96,12 +94,11 @@ SProcXGrabDevice(client)
swapl(&stuff->grabWindow, n);
swapl(&stuff->time, n);
swaps(&stuff->event_count, n);
- p = (long *) &stuff[1];
- for (i=0; i<stuff->event_count; i++)
- {
- swapl(p, n);
- p++;
- }
+
+ if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
+ return BadLength;
+
+ SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDevice(client));
}
diff --git a/nx-X11/programs/Xserver/Xi/grabdevb.c b/nx-X11/programs/Xserver/Xi/grabdevb.c
index 84f061086..ad43c29a0 100644
--- a/nx-X11/programs/Xserver/Xi/grabdevb.c
+++ b/nx-X11/programs/Xserver/Xi/grabdevb.c
@@ -84,8 +84,6 @@ SProcXGrabDeviceButton(client)
register ClientPtr client;
{
register char n;
- register long *p;
- register int i;
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length, n);
@@ -93,12 +91,9 @@ SProcXGrabDeviceButton(client)
swapl(&stuff->grabWindow, n);
swaps(&stuff->modifiers, n);
swaps(&stuff->event_count, n);
- p = (long *) &stuff[1];
- for (i=0; i<stuff->event_count; i++)
- {
- swapl(p, n);
- p++;
- }
+ REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
+ stuff->event_count * sizeof(CARD32));
+ SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDeviceButton(client));
}
diff --git a/nx-X11/programs/Xserver/Xi/grabdevk.c b/nx-X11/programs/Xserver/Xi/grabdevk.c
index 17a9a9cf6..952c5d89a 100644
--- a/nx-X11/programs/Xserver/Xi/grabdevk.c
+++ b/nx-X11/programs/Xserver/Xi/grabdevk.c
@@ -84,8 +84,6 @@ SProcXGrabDeviceKey(client)
register ClientPtr client;
{
register char n;
- register long *p;
- register int i;
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length, n);
@@ -93,12 +91,8 @@ SProcXGrabDeviceKey(client)
swapl(&stuff->grabWindow, n);
swaps(&stuff->modifiers, n);
swaps(&stuff->event_count, n);
- p = (long *) &stuff[1];
- for (i=0; i<stuff->event_count; i++)
- {
- swapl(p, n);
- p++;
- }
+ REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
+ SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDeviceKey(client));
}
diff --git a/nx-X11/programs/Xserver/Xi/selectev.c b/nx-X11/programs/Xserver/Xi/selectev.c
index c8a55f5b0..a9b731864 100644
--- a/nx-X11/programs/Xserver/Xi/selectev.c
+++ b/nx-X11/programs/Xserver/Xi/selectev.c
@@ -88,20 +88,16 @@ SProcXSelectExtensionEvent (client)
register ClientPtr client;
{
register char n;
- register long *p;
- register int i;
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window, n);
swaps(&stuff->count, n);
- p = (long *) &stuff[1];
- for (i=0; i<stuff->count; i++)
- {
- swapl(p, n);
- p++;
- }
+ REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
+ stuff->count * sizeof(CARD32));
+ SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
+
return(ProcXSelectExtensionEvent(client));
}
diff --git a/nx-X11/programs/Xserver/Xi/sendexev.c b/nx-X11/programs/Xserver/Xi/sendexev.c
index c005aecab..9b441f2d8 100644
--- a/nx-X11/programs/Xserver/Xi/sendexev.c
+++ b/nx-X11/programs/Xserver/Xi/sendexev.c
@@ -87,7 +87,7 @@ SProcXSendExtensionEvent(client)
register ClientPtr client;
{
register char n;
- register long *p;
+ CARD32 *p;
register int i;
xEvent eventT;
xEvent *eventP;
@@ -98,6 +98,11 @@ SProcXSendExtensionEvent(client)
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
swapl(&stuff->destination, n);
swaps(&stuff->count, n);
+
+ if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
+ (stuff->num_events * (sizeof(xEvent) >> 2)))
+ return BadLength;
+
eventP = (xEvent *) &stuff[1];
for (i=0; i<stuff->num_events; i++,eventP++)
{
@@ -108,12 +113,8 @@ SProcXSendExtensionEvent(client)
*eventP = eventT;
}
- p = (long *) (((xEvent *) &stuff[1]) + stuff->num_events);
- for (i=0; i<stuff->count; i++)
- {
- swapl(p, n);
- p++;
- }
+ p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
+ SwapLongs(p, stuff->count);
return(ProcXSendExtensionEvent(client));
}