Unverified Commit ca19c342 authored by Mihai Moldovan's avatar Mihai Moldovan

Merge branch 'uli42-pr/backported_fixes' into arctica-3.6.x

parents 61013ec4 d0886983
...@@ -94,6 +94,7 @@ ProcBigReqDispatch (client) ...@@ -94,6 +94,7 @@ ProcBigReqDispatch (client)
return BadRequest; return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq); REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE; client->big_requests = TRUE;
memset(&rep, 0, sizeof(xBigReqEnableReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -292,6 +292,7 @@ ProcShapeQueryVersion (client) ...@@ -292,6 +292,7 @@ ProcShapeQueryVersion (client)
register int n; register int n;
REQUEST_SIZE_MATCH (xShapeQueryVersionReq); REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -717,6 +718,7 @@ ProcShapeQueryExtents (client) ...@@ -717,6 +718,7 @@ ProcShapeQueryExtents (client)
RegionPtr region; RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
pWin = LookupWindow (stuff->window, client); pWin = LookupWindow (stuff->window, client);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
......
...@@ -346,6 +346,7 @@ ProcShmQueryVersion(client) ...@@ -346,6 +346,7 @@ ProcShmQueryVersion(client)
register int n; register int n;
REQUEST_SIZE_MATCH(xShmQueryVersionReq); REQUEST_SIZE_MATCH(xShmQueryVersionReq);
memset(&rep, 0, sizeof(xShmQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -1346,6 +1346,7 @@ ProcSyncInitialize(client) ...@@ -1346,6 +1346,7 @@ ProcSyncInitialize(client)
REQUEST_SIZE_MATCH(xSyncInitializeReq); REQUEST_SIZE_MATCH(xSyncInitializeReq);
memset(&rep, 0, sizeof(xSyncInitializeReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.majorVersion = SYNC_MAJOR_VERSION; rep.majorVersion = SYNC_MAJOR_VERSION;
......
...@@ -114,6 +114,7 @@ ProcXGetExtensionVersion (client) ...@@ -114,6 +114,7 @@ ProcXGetExtensionVersion (client)
return Success; return Success;
} }
memset(&rep, 0, sizeof(xGetExtensionVersionReply));
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion; rep.RepType = X_GetExtensionVersion;
rep.length = 0; rep.length = 0;
......
...@@ -114,6 +114,7 @@ ProcXListInputDevices (client) ...@@ -114,6 +114,7 @@ ProcXListInputDevices (client)
REQUEST_SIZE_MATCH(xListInputDevicesReq); REQUEST_SIZE_MATCH(xListInputDevicesReq);
memset(&rep, 0, sizeof(xListInputDevicesReply));
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_ListInputDevices; rep.RepType = X_ListInputDevices;
rep.length = 0; rep.length = 0;
...@@ -128,7 +129,7 @@ ProcXListInputDevices (client) ...@@ -128,7 +129,7 @@ ProcXListInputDevices (client)
SizeDeviceInfo (d, &namesize, &size); SizeDeviceInfo (d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize; total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
devbuf = (char *) xalloc (total_length); devbuf = (char *) xcalloc (1, total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo)); classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
namebuf = classbuf + size; namebuf = classbuf + size;
savbuf = devbuf; savbuf = devbuf;
......
...@@ -141,6 +141,7 @@ ProcXOpenDevice(client) ...@@ -141,6 +141,7 @@ ProcXOpenDevice(client)
if (enableit && dev->inited && dev->startup) if (enableit && dev->inited && dev->startup)
(void)EnableDevice(dev); (void)EnableDevice(dev);
memset(&rep, 0, sizeof(xOpenDeviceReply));
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_OpenDevice; rep.RepType = X_OpenDevice;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -1037,6 +1037,7 @@ ProcGetModifierMapping(ClientPtr client) ...@@ -1037,6 +1037,7 @@ ProcGetModifierMapping(ClientPtr client)
register KeyClassPtr keyc = inputInfo.keyboard->key; register KeyClassPtr keyc = inputInfo.keyboard->key;
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&rep, 0, sizeof(xGetModifierMappingReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.numKeyPerModifier = keyc->maxKeysPerModifier; rep.numKeyPerModifier = keyc->maxKeysPerModifier;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -1157,6 +1158,7 @@ ProcGetKeyboardMapping(ClientPtr client) ...@@ -1157,6 +1158,7 @@ ProcGetKeyboardMapping(ClientPtr client)
return BadValue; return BadValue;
} }
memset(&rep, 0, sizeof(xGetKeyboardMappingReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = curKeySyms->mapWidth; rep.keySymsPerKeyCode = curKeySyms->mapWidth;
......
...@@ -579,6 +579,7 @@ ProcGetWindowAttributes(register ClientPtr client) ...@@ -579,6 +579,7 @@ ProcGetWindowAttributes(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pWin) if (!pWin)
return(BadWindow); return(BadWindow);
memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa); GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
return(client->noClientException); return(client->noClientException);
...@@ -834,6 +835,7 @@ ProcGetGeometry(register ClientPtr client) ...@@ -834,6 +835,7 @@ ProcGetGeometry(register ClientPtr client)
xGetGeometryReply rep; xGetGeometryReply rep;
int status; int status;
memset(&rep, 0, sizeof(xGetGeometryReply));
if ((status = GetGeometry(client, &rep)) != Success) if ((status = GetGeometry(client, &rep)) != Success)
return status; return status;
...@@ -856,6 +858,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -856,6 +858,7 @@ ProcQueryTree(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pWin) if (!pWin)
return(BadWindow); return(BadWindow);
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -909,6 +912,7 @@ ProcInternAtom(register ClientPtr client) ...@@ -909,6 +912,7 @@ ProcInternAtom(register ClientPtr client)
if (atom != BAD_RESOURCE) if (atom != BAD_RESOURCE)
{ {
xInternAtomReply reply; xInternAtomReply reply;
memset(&reply, 0, sizeof(xInternAtomReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -932,6 +936,7 @@ ProcGetAtomName(register ClientPtr client) ...@@ -932,6 +936,7 @@ ProcGetAtomName(register ClientPtr client)
if ( (str = NameForAtom(stuff->id)) ) if ( (str = NameForAtom(stuff->id)) )
{ {
len = strlen(str); len = strlen(str);
memset(&reply, 0, sizeof(xGetAtomNameReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (len + 3) >> 2; reply.length = (len + 3) >> 2;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -1061,6 +1066,7 @@ ProcGetSelectionOwner(register ClientPtr client) ...@@ -1061,6 +1066,7 @@ ProcGetSelectionOwner(register ClientPtr client)
i = 0; i = 0;
while ((i < NumCurrentSelections) && while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != stuff->id) i++; CurrentSelections[i].selection != stuff->id) i++;
memset(&reply, 0, sizeof(xGetSelectionOwnerReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -1112,6 +1118,7 @@ ProcConvertSelection(register ClientPtr client) ...@@ -1112,6 +1118,7 @@ ProcConvertSelection(register ClientPtr client)
#endif #endif
) )
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = SelectionRequest; event.u.u.type = SelectionRequest;
event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.time = stuff->time;
event.u.selectionRequest.owner = event.u.selectionRequest.owner =
...@@ -1125,6 +1132,7 @@ ProcConvertSelection(register ClientPtr client) ...@@ -1125,6 +1132,7 @@ ProcConvertSelection(register ClientPtr client)
NoEventMask /* CantBeFiltered */, NullGrab)) NoEventMask /* CantBeFiltered */, NullGrab))
return (client->noClientException); return (client->noClientException);
} }
memset(&event, 0, sizeof(xEvent));
event.u.u.type = SelectionNotify; event.u.u.type = SelectionNotify;
event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.time = stuff->time;
event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.requestor = stuff->requestor;
...@@ -1221,6 +1229,7 @@ ProcTranslateCoords(register ClientPtr client) ...@@ -1221,6 +1229,7 @@ ProcTranslateCoords(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pDst) if (!pDst)
return(BadWindow); return(BadWindow);
memset(&rep, 0, sizeof(xTranslateCoordsReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -1370,6 +1379,7 @@ ProcQueryFont(register ClientPtr client) ...@@ -1370,6 +1379,7 @@ ProcQueryFont(register ClientPtr client)
return(BadAlloc); return(BadAlloc);
} }
memset(reply, 0, rlength);
reply->type = X_Reply; reply->type = X_Reply;
reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->length = (rlength - sizeof(xGenericReply)) >> 2;
reply->sequenceNumber = client->sequence; reply->sequenceNumber = client->sequence;
...@@ -2112,6 +2122,8 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2112,6 +2122,8 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
return(BadValue); return(BadValue);
} }
SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess);
memset(&xgi, 0, sizeof(xGetImageReply));
if(pDraw->type == DRAWABLE_WINDOW) if(pDraw->type == DRAWABLE_WINDOW)
{ {
if( /* check for being viewable */ if( /* check for being viewable */
...@@ -2165,7 +2177,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2165,7 +2177,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
xgi.length = length; xgi.length = length;
if (im_return) { if (im_return) {
pBuf = (char *)xalloc(sz_xGetImageReply + length); pBuf = (char *)xcalloc(1, sz_xGetImageReply + length);
if (!pBuf) if (!pBuf)
return (BadAlloc); return (BadAlloc);
if (widthBytesLine == 0) if (widthBytesLine == 0)
...@@ -2205,6 +2217,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2205,6 +2217,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
} }
if(!(pBuf = (char *) ALLOCATE_LOCAL(length))) if(!(pBuf = (char *) ALLOCATE_LOCAL(length)))
return (BadAlloc); return (BadAlloc);
memset(pBuf, 0, length);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
} }
...@@ -2973,6 +2986,7 @@ ProcQueryColors(register ClientPtr client) ...@@ -2973,6 +2986,7 @@ ProcQueryColors(register ClientPtr client)
prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb)); prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb));
if(!prgbs && count) if(!prgbs && count)
return(BadAlloc); return(BadAlloc);
memset(prgbs, 0, count * sizeof(xrgb));
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
{ {
if (prgbs) DEALLOCATE_LOCAL(prgbs); if (prgbs) DEALLOCATE_LOCAL(prgbs);
...@@ -2984,6 +2998,8 @@ ProcQueryColors(register ClientPtr client) ...@@ -2984,6 +2998,8 @@ ProcQueryColors(register ClientPtr client)
return (retval); return (retval);
} }
} }
memset(&qcr, 0, sizeof(xQueryColorsReply));
qcr.type = X_Reply; qcr.type = X_Reply;
qcr.length = (count * sizeof(xrgb)) >> 2; qcr.length = (count * sizeof(xrgb)) >> 2;
qcr.sequenceNumber = client->sequence; qcr.sequenceNumber = client->sequence;
...@@ -3201,6 +3217,7 @@ ProcQueryBestSize (register ClientPtr client) ...@@ -3201,6 +3217,7 @@ ProcQueryBestSize (register ClientPtr client)
pScreen = pDraw->pScreen; pScreen = pDraw->pScreen;
(* pScreen->QueryBestSize)(stuff->class, &stuff->width, (* pScreen->QueryBestSize)(stuff->class, &stuff->width,
&stuff->height, pScreen); &stuff->height, pScreen);
memset(&reply, 0, sizeof(xQueryBestSizeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -3976,6 +3993,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, ...@@ -3976,6 +3993,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
{ {
xError rep; xError rep;
memset(&rep, 0, sizeof(xError));
rep.type = X_Error; rep.type = X_Error;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.errorCode = errorCode; rep.errorCode = errorCode;
......
...@@ -850,6 +850,7 @@ finish: ...@@ -850,6 +850,7 @@ finish:
for (i = 0; i < nnames; i++) for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0; stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
memset(&reply, 0, sizeof(xListFontsReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (stringLens + nnames + 3) >> 2; reply.length = (stringLens + nnames + 3) >> 2;
reply.nFonts = nnames; reply.nFonts = nnames;
...@@ -1102,6 +1103,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -1102,6 +1103,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
err = AllocError; err = AllocError;
break; break;
} }
memset(reply + c->length, 0, length - c->length);
c->reply = reply; c->reply = reply;
c->length = length; c->length = length;
} }
......
...@@ -3733,6 +3733,7 @@ ProcGetInputFocus(ClientPtr client) ...@@ -3733,6 +3733,7 @@ ProcGetInputFocus(ClientPtr client)
FocusClassPtr focus = inputInfo.keyboard->focus; FocusClassPtr focus = inputInfo.keyboard->focus;
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&rep, 0, sizeof(xGetInputFocusReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -3807,6 +3808,7 @@ ProcGrabPointer(ClientPtr client) ...@@ -3807,6 +3808,7 @@ ProcGrabPointer(ClientPtr client)
} }
/* at this point, some sort of reply is guaranteed. */ /* at this point, some sort of reply is guaranteed. */
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);
memset(&rep, 0, sizeof(xGrabPointerReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = 0; rep.length = 0;
...@@ -3982,6 +3984,7 @@ ProcGrabKeyboard(ClientPtr client) ...@@ -3982,6 +3984,7 @@ ProcGrabKeyboard(ClientPtr client)
int result; int result;
REQUEST_SIZE_MATCH(xGrabKeyboardReq); REQUEST_SIZE_MATCH(xGrabKeyboardReq);
memset(&rep, 0, sizeof(xGrabKeyboardReply));
#ifdef XCSECURITY #ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
{ {
...@@ -4036,6 +4039,7 @@ ProcQueryPointer(ClientPtr client) ...@@ -4036,6 +4039,7 @@ ProcQueryPointer(ClientPtr client)
return BadWindow; return BadWindow;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
memset(&rep, 0, sizeof(xQueryPointerReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.mask = mouse->button->state | inputInfo.keyboard->key->state; rep.mask = mouse->button->state | inputInfo.keyboard->key->state;
......
...@@ -313,6 +313,7 @@ ProcQueryExtension(ClientPtr client) ...@@ -313,6 +313,7 @@ ProcQueryExtension(ClientPtr client)
REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes); REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
memset(&reply, 0, sizeof(xQueryExtensionReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.major_opcode = 0; reply.major_opcode = 0;
...@@ -352,6 +353,7 @@ ProcListExtensions(ClientPtr client) ...@@ -352,6 +353,7 @@ ProcListExtensions(ClientPtr client)
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&reply, 0, sizeof(xListExtensionsReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.nExtensions = 0; reply.nExtensions = 0;
reply.length = 0; reply.length = 0;
......
...@@ -534,6 +534,7 @@ CreateConnectionBlock() ...@@ -534,6 +534,7 @@ CreateConnectionBlock()
char *pBuf; char *pBuf;
memset(&setup, 0, sizeof(xConnSetup));
/* Leave off the ridBase and ridMask, these must be sent with /* Leave off the ridBase and ridMask, these must be sent with
connection */ connection */
...@@ -574,6 +575,7 @@ CreateConnectionBlock() ...@@ -574,6 +575,7 @@ CreateConnectionBlock()
while (--i >= 0) while (--i >= 0)
*pBuf++ = 0; *pBuf++ = 0;
memset(&format, 0, sizeof(xPixmapFormat));
for (i=0; i<screenInfo.numPixmapFormats; i++) for (i=0; i<screenInfo.numPixmapFormats; i++)
{ {
format.depth = screenInfo.formats[i].depth; format.depth = screenInfo.formats[i].depth;
...@@ -585,6 +587,8 @@ CreateConnectionBlock() ...@@ -585,6 +587,8 @@ CreateConnectionBlock()
} }
connBlockScreenStart = sizesofar; connBlockScreenStart = sizesofar;
memset(&depth, 0, sizeof(xDepth));
memset(&visual, 0, sizeof(xVisualType));
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
{ {
ScreenPtr pScreen; ScreenPtr pScreen;
......
...@@ -531,6 +531,7 @@ ProcGetProperty(ClientPtr client) ...@@ -531,6 +531,7 @@ ProcGetProperty(ClientPtr client)
pProp = pProp->next; pProp = pProp->next;
} }
memset(&reply, 0, sizeof(xGetPropertyReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
if (!pProp) if (!pProp)
......
...@@ -774,6 +774,7 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w, ...@@ -774,6 +774,7 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
if (SubSend(pParent)) if (SubSend(pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = CreateNotify; event.u.u.type = CreateNotify;
event.u.createNotify.window = wid; event.u.createNotify.window = wid;
event.u.createNotify.parent = pParent->drawable.id; event.u.createNotify.parent = pParent->drawable.id;
...@@ -841,6 +842,7 @@ CrushTree(WindowPtr pWin) ...@@ -841,6 +842,7 @@ CrushTree(WindowPtr pWin)
pParent = pChild->parent; pParent = pChild->parent;
if (SubStrSend(pChild, pParent)) if (SubStrSend(pChild, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = DestroyNotify; event.u.u.type = DestroyNotify;
event.u.destroyNotify.window = pChild->drawable.id; event.u.destroyNotify.window = pChild->drawable.id;
DeliverEvents(pChild, &event, 1, NullWindow); DeliverEvents(pChild, &event, 1, NullWindow);
...@@ -890,6 +892,7 @@ DeleteWindow(pointer value, XID wid) ...@@ -890,6 +892,7 @@ DeleteWindow(pointer value, XID wid)
pParent = pWin->parent; pParent = pWin->parent;
if (wid && pParent && SubStrSend(pWin, pParent)) if (wid && pParent && SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = DestroyNotify; event.u.u.type = DestroyNotify;
event.u.destroyNotify.window = pWin->drawable.id; event.u.destroyNotify.window = pWin->drawable.id;
DeliverEvents(pWin, &event, 1, NullWindow); DeliverEvents(pWin, &event, 1, NullWindow);
...@@ -2306,6 +2309,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP ...@@ -2306,6 +2309,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
#endif #endif
)) ))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ConfigureRequest; event.u.u.type = ConfigureRequest;
event.u.configureRequest.window = pWin->drawable.id; event.u.configureRequest.window = pWin->drawable.id;
if (mask & CWSibling) if (mask & CWSibling)
...@@ -2350,6 +2354,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP ...@@ -2350,6 +2354,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask)) if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask))
{ {
xEvent eventT; xEvent eventT;
memset(&eventT, 0, sizeof(xEvent));
eventT.u.u.type = ResizeRequest; eventT.u.u.type = ResizeRequest;
eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.window = pWin->drawable.id;
eventT.u.resizeRequest.width = w; eventT.u.resizeRequest.width = w;
...@@ -2396,6 +2401,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP ...@@ -2396,6 +2401,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
ActuallyDoSomething: ActuallyDoSomething:
if (SubStrSend(pWin, pParent)) if (SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ConfigureNotify; event.u.u.type = ConfigureNotify;
event.u.configureNotify.window = pWin->drawable.id; event.u.configureNotify.window = pWin->drawable.id;
if (pSib) if (pSib)
...@@ -2552,6 +2558,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, ...@@ -2552,6 +2558,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent,
if (WasMapped) if (WasMapped)
UnmapWindow(pWin, FALSE); UnmapWindow(pWin, FALSE);
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ReparentNotify; event.u.u.type = ReparentNotify;
event.u.reparent.window = pWin->drawable.id; event.u.reparent.window = pWin->drawable.id;
event.u.reparent.parent = pParent->drawable.id; event.u.reparent.parent = pParent->drawable.id;
...@@ -2708,6 +2715,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client) ...@@ -2708,6 +2715,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
#endif #endif
)) ))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapRequest; event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.window = pWin->drawable.id;
#ifdef XAPPGROUP #ifdef XAPPGROUP
...@@ -2730,6 +2738,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client) ...@@ -2730,6 +2738,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
pWin->mapped = TRUE; pWin->mapped = TRUE;
if (SubStrSend(pWin, pParent)) if (SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapNotify; event.u.u.type = MapNotify;
event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.window = pWin->drawable.id;
event.u.mapNotify.override = pWin->overrideRedirect; event.u.mapNotify.override = pWin->overrideRedirect;
...@@ -2820,6 +2829,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client) ...@@ -2820,6 +2829,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client)
{ {
if (parentRedirect && !pWin->overrideRedirect) if (parentRedirect && !pWin->overrideRedirect)
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapRequest; event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.window = pWin->drawable.id;
event.u.mapRequest.parent = pParent->drawable.id; event.u.mapRequest.parent = pParent->drawable.id;
...@@ -2832,6 +2842,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client) ...@@ -2832,6 +2842,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client)
pWin->mapped = TRUE; pWin->mapped = TRUE;
if (parentNotify || StrSend(pWin)) if (parentNotify || StrSend(pWin))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapNotify; event.u.u.type = MapNotify;
event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.window = pWin->drawable.id;
event.u.mapNotify.override = pWin->overrideRedirect; event.u.mapNotify.override = pWin->overrideRedirect;
...@@ -2985,6 +2996,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure) ...@@ -2985,6 +2996,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
return(Success); return(Success);
if (SubStrSend(pWin, pParent)) if (SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = UnmapNotify; event.u.u.type = UnmapNotify;
event.u.unmapNotify.window = pWin->drawable.id; event.u.unmapNotify.window = pWin->drawable.id;
event.u.unmapNotify.fromConfigure = fromConfigure; event.u.unmapNotify.fromConfigure = fromConfigure;
...@@ -3279,6 +3291,7 @@ SendVisibilityNotify(WindowPtr pWin) ...@@ -3279,6 +3291,7 @@ SendVisibilityNotify(WindowPtr pWin)
} }
#endif #endif
memset(&event, 0, sizeof(xEvent));
event.u.u.type = VisibilityNotify; event.u.u.type = VisibilityNotify;
event.u.visibility.window = pWin->drawable.id; event.u.visibility.window = pWin->drawable.id;
event.u.visibility.state = visibility; event.u.visibility.state = visibility;
......
...@@ -1214,6 +1214,7 @@ void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode) ...@@ -1214,6 +1214,7 @@ void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode)
dev = inputInfo.keyboard; dev = inputInfo.keyboard;
xkb = dev -> key -> xkbInfo -> desc; xkb = dev -> key -> xkbInfo -> desc;
memset(&nkn, 0, sizeof(xkbNewKeyboardNotify));
nkn.deviceID = nkn.oldDeviceID = dev -> id; nkn.deviceID = nkn.oldDeviceID = dev -> id;
nkn.minKeyCode = 8; nkn.minKeyCode = 8;
nkn.maxKeyCode = 255; nkn.maxKeyCode = 255;
...@@ -1233,6 +1234,7 @@ void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode) ...@@ -1233,6 +1234,7 @@ void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode)
int i; int i;
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MappingNotify; event.u.u.type = MappingNotify;
event.u.mappingNotify.request = MappingKeyboard; event.u.mappingNotify.request = MappingKeyboard;
event.u.mappingNotify.firstKeyCode = inputInfo.keyboard -> key -> curKeySyms.minKeyCode; event.u.mappingNotify.firstKeyCode = inputInfo.keyboard -> key -> curKeySyms.minKeyCode;
......
...@@ -931,6 +931,7 @@ ProcGetWindowAttributes(register ClientPtr client) ...@@ -931,6 +931,7 @@ ProcGetWindowAttributes(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pWin) if (!pWin)
return(BadWindow); return(BadWindow);
memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa); GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
return(client->noClientException); return(client->noClientException);
...@@ -1155,6 +1156,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) ...@@ -1155,6 +1156,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess);
memset(rep, 0, sizeof(xGetGeometryReply));
rep->type = X_Reply; rep->type = X_Reply;
rep->length = 0; rep->length = 0;
rep->sequenceNumber = client->sequence; rep->sequenceNumber = client->sequence;
...@@ -1216,6 +1218,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -1216,6 +1218,7 @@ ProcQueryTree(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pWin) if (!pWin)
return(BadWindow); return(BadWindow);
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -1279,6 +1282,7 @@ ProcInternAtom(register ClientPtr client) ...@@ -1279,6 +1282,7 @@ ProcInternAtom(register ClientPtr client)
if (atom != BAD_RESOURCE) if (atom != BAD_RESOURCE)
{ {
xInternAtomReply reply; xInternAtomReply reply;
memset(&reply, 0, sizeof(xInternAtomReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -1302,6 +1306,7 @@ ProcGetAtomName(register ClientPtr client) ...@@ -1302,6 +1306,7 @@ ProcGetAtomName(register ClientPtr client)
if ( (str = NameForAtom(stuff->id)) ) if ( (str = NameForAtom(stuff->id)) )
{ {
len = strlen(str); len = strlen(str);
memset(&reply, 0, sizeof(xGetAtomNameReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (len + 3) >> 2; reply.length = (len + 3) >> 2;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -1441,6 +1446,7 @@ ProcGetSelectionOwner(register ClientPtr client) ...@@ -1441,6 +1446,7 @@ ProcGetSelectionOwner(register ClientPtr client)
i = 0; i = 0;
while ((i < NumCurrentSelections) && while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != stuff->id) i++; CurrentSelections[i].selection != stuff->id) i++;
memset(&reply, 0, sizeof(xGetSelectionOwnerReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -1512,7 +1518,9 @@ ProcConvertSelection(register ClientPtr client) ...@@ -1512,7 +1518,9 @@ ProcConvertSelection(register ClientPtr client)
CurrentSelections[i].pWin)) CurrentSelections[i].pWin))
#endif #endif
) )
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = SelectionRequest; event.u.u.type = SelectionRequest;
event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.time = stuff->time;
event.u.selectionRequest.owner = event.u.selectionRequest.owner =
...@@ -1526,6 +1534,7 @@ ProcConvertSelection(register ClientPtr client) ...@@ -1526,6 +1534,7 @@ ProcConvertSelection(register ClientPtr client)
NoEventMask /* CantBeFiltered */, NullGrab)) NoEventMask /* CantBeFiltered */, NullGrab))
return (client->noClientException); return (client->noClientException);
} }
memset(&event, 0, sizeof(xEvent));
event.u.u.type = SelectionNotify; event.u.u.type = SelectionNotify;
event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.time = stuff->time;
event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.requestor = stuff->requestor;
...@@ -1622,6 +1631,7 @@ ProcTranslateCoords(register ClientPtr client) ...@@ -1622,6 +1631,7 @@ ProcTranslateCoords(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pDst) if (!pDst)
return(BadWindow); return(BadWindow);
memset(&rep, 0, sizeof(xTranslateCoordsReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -1850,6 +1860,7 @@ ProcQueryFont(register ClientPtr client) ...@@ -1850,6 +1860,7 @@ ProcQueryFont(register ClientPtr client)
{ {
return(BadAlloc); return(BadAlloc);
} }
memset(reply, 0, rlength);
reply->type = X_Reply; reply->type = X_Reply;
reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->length = (rlength - sizeof(xGenericReply)) >> 2;
...@@ -2659,6 +2670,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2659,6 +2670,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
return(BadValue); return(BadValue);
} }
SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess);
memset(&xgi, 0, sizeof(xGetImageReply));
if(pDraw->type == DRAWABLE_WINDOW) if(pDraw->type == DRAWABLE_WINDOW)
{ {
if( /* check for being viewable */ if( /* check for being viewable */
...@@ -2712,9 +2724,10 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2712,9 +2724,10 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
xgi.length = length; xgi.length = length;
if (im_return) { if (im_return) {
pBuf = (char *)xalloc(sz_xGetImageReply + length); pBuf = (char *)xcalloc(1, sz_xGetImageReply + length);
if (!pBuf) if (!pBuf)
return (BadAlloc); return (BadAlloc);
if (widthBytesLine == 0) if (widthBytesLine == 0)
linesPerBuf = 0; linesPerBuf = 0;
else else
...@@ -2752,6 +2765,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2752,6 +2765,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
} }
if(!(pBuf = (char *) ALLOCATE_LOCAL(length))) if(!(pBuf = (char *) ALLOCATE_LOCAL(length)))
return (BadAlloc); return (BadAlloc);
memset(pBuf, 0, length);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
} }
...@@ -3520,6 +3534,7 @@ ProcQueryColors(register ClientPtr client) ...@@ -3520,6 +3534,7 @@ ProcQueryColors(register ClientPtr client)
prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb)); prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb));
if(!prgbs && count) if(!prgbs && count)
return(BadAlloc); return(BadAlloc);
memset(prgbs, 0, count * sizeof(xrgb));
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
{ {
if (prgbs) DEALLOCATE_LOCAL(prgbs); if (prgbs) DEALLOCATE_LOCAL(prgbs);
...@@ -3531,6 +3546,7 @@ ProcQueryColors(register ClientPtr client) ...@@ -3531,6 +3546,7 @@ ProcQueryColors(register ClientPtr client)
return (retval); return (retval);
} }
} }
memset(&qcr, 0, sizeof(xQueryColorsReply));
qcr.type = X_Reply; qcr.type = X_Reply;
qcr.length = (count * sizeof(xrgb)) >> 2; qcr.length = (count * sizeof(xrgb)) >> 2;
qcr.sequenceNumber = client->sequence; qcr.sequenceNumber = client->sequence;
...@@ -3755,6 +3771,7 @@ ProcQueryBestSize (register ClientPtr client) ...@@ -3755,6 +3771,7 @@ ProcQueryBestSize (register ClientPtr client)
pScreen = pDraw->pScreen; pScreen = pDraw->pScreen;
(* pScreen->QueryBestSize)(stuff->class, &stuff->width, (* pScreen->QueryBestSize)(stuff->class, &stuff->width,
&stuff->height, pScreen); &stuff->height, pScreen);
memset(&reply, 0, sizeof(xQueryBestSizeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -4623,6 +4640,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, ...@@ -4623,6 +4640,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
{ {
xError rep; xError rep;
memset(&rep, 0, sizeof(xError));
rep.type = X_Error; rep.type = X_Error;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.errorCode = errorCode; rep.errorCode = errorCode;
......
...@@ -929,6 +929,7 @@ finish: ...@@ -929,6 +929,7 @@ finish:
for (i = 0; i < nnames; i++) for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0; stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
memset(&reply, 0, sizeof(xListFontsReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (stringLens + nnames + 3) >> 2; reply.length = (stringLens + nnames + 3) >> 2;
reply.nFonts = nnames; reply.nFonts = nnames;
...@@ -1227,6 +1228,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -1227,6 +1228,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
err = AllocError; err = AllocError;
break; break;
} }
memset(reply + c->length, 0, length - c->length);
c->reply = reply; c->reply = reply;
c->length = length; c->length = length;
} }
......
...@@ -3606,6 +3606,7 @@ EnterLeaveEvent( ...@@ -3606,6 +3606,7 @@ EnterLeaveEvent(
} }
if (mask & filters[type]) if (mask & filters[type])
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = type; event.u.u.type = type;
event.u.u.detail = detail; event.u.u.detail = detail;
event.u.enterLeave.time = currentTime.milliseconds; event.u.enterLeave.time = currentTime.milliseconds;
...@@ -4024,6 +4025,7 @@ ProcGetInputFocus(ClientPtr client) ...@@ -4024,6 +4025,7 @@ ProcGetInputFocus(ClientPtr client)
FocusClassPtr focus = inputInfo.keyboard->focus; FocusClassPtr focus = inputInfo.keyboard->focus;
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&rep, 0, sizeof(xGetInputFocusReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -4104,6 +4106,7 @@ ProcGrabPointer(ClientPtr client) ...@@ -4104,6 +4106,7 @@ ProcGrabPointer(ClientPtr client)
} }
/* at this point, some sort of reply is guaranteed. */ /* at this point, some sort of reply is guaranteed. */
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);
memset(&rep, 0, sizeof(xGrabPointerReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = 0; rep.length = 0;
...@@ -4321,6 +4324,8 @@ ProcGrabKeyboard(ClientPtr client) ...@@ -4321,6 +4324,8 @@ ProcGrabKeyboard(ClientPtr client)
} }
#endif #endif
REQUEST_SIZE_MATCH(xGrabKeyboardReq); REQUEST_SIZE_MATCH(xGrabKeyboardReq);
memset(&rep, 0, sizeof(xGrabKeyboardReply));
#ifdef XCSECURITY #ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
{ {
...@@ -4399,6 +4404,7 @@ ProcQueryPointer(ClientPtr client) ...@@ -4399,6 +4404,7 @@ ProcQueryPointer(ClientPtr client)
return BadWindow; return BadWindow;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
memset(&rep, 0, sizeof(xQueryPointerReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.mask = mouse->button->state | inputInfo.keyboard->key->state; rep.mask = mouse->button->state | inputInfo.keyboard->key->state;
......
...@@ -332,6 +332,7 @@ ProcQueryExtension(ClientPtr client) ...@@ -332,6 +332,7 @@ ProcQueryExtension(ClientPtr client)
REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes); REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
memset(&reply, 0, sizeof(xQueryExtensionReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.major_opcode = 0; reply.major_opcode = 0;
...@@ -378,6 +379,7 @@ ProcListExtensions(ClientPtr client) ...@@ -378,6 +379,7 @@ ProcListExtensions(ClientPtr client)
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&reply, 0, sizeof(xListExtensionsReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.nExtensions = 0; reply.nExtensions = 0;
reply.length = 0; reply.length = 0;
......
...@@ -457,6 +457,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) ...@@ -457,6 +457,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
else else
{ {
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = NoExpose; event.u.u.type = NoExpose;
event.u.noExposure.drawable = drawable; event.u.noExposure.drawable = drawable;
event.u.noExposure.majorEvent = major; event.u.noExposure.majorEvent = major;
...@@ -482,7 +483,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -482,7 +483,7 @@ miSendExposures(pWin, pRgn, dx, dy)
numRects = REGION_NUM_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn);
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
return; return;
memset(pEvent, 0, numRects * sizeof(xEvent));
for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
{ {
pe->u.u.type = Expose; pe->u.u.type = Expose;
......
...@@ -620,6 +620,7 @@ ProcGetProperty(ClientPtr client) ...@@ -620,6 +620,7 @@ ProcGetProperty(ClientPtr client)
pProp = pProp->next; pProp = pProp->next;
} }
memset(&reply, 0, sizeof(xGetPropertyReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
......
...@@ -392,6 +392,7 @@ ProcRenderQueryVersion (ClientPtr client) ...@@ -392,6 +392,7 @@ ProcRenderQueryVersion (ClientPtr client)
pRenderClient->major_version = stuff->majorVersion; pRenderClient->major_version = stuff->majorVersion;
pRenderClient->minor_version = stuff->minorVersion; pRenderClient->minor_version = stuff->minorVersion;
memset(&rep, 0, sizeof(xRenderQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -516,6 +517,7 @@ ProcRenderQueryPictFormats (ClientPtr client) ...@@ -516,6 +517,7 @@ ProcRenderQueryPictFormats (ClientPtr client)
reply = (xRenderQueryPictFormatsReply *) xalloc (rlength); reply = (xRenderQueryPictFormatsReply *) xalloc (rlength);
if (!reply) if (!reply)
return BadAlloc; return BadAlloc;
memset(reply, 0, rlength);
reply->type = X_Reply; reply->type = X_Reply;
reply->sequenceNumber = client->sequence; reply->sequenceNumber = client->sequence;
reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->length = (rlength - sizeof(xGenericReply)) >> 2;
......
...@@ -401,6 +401,7 @@ ProcShmQueryVersion(client) ...@@ -401,6 +401,7 @@ ProcShmQueryVersion(client)
register int n; register int n;
REQUEST_SIZE_MATCH(xShmQueryVersionReq); REQUEST_SIZE_MATCH(xShmQueryVersionReq);
memset(&rep, 0, sizeof(xShmQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -960,6 +960,7 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w, ...@@ -960,6 +960,7 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
if (SubSend(pParent)) if (SubSend(pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = CreateNotify; event.u.u.type = CreateNotify;
event.u.createNotify.window = wid; event.u.createNotify.window = wid;
event.u.createNotify.parent = pParent->drawable.id; event.u.createNotify.parent = pParent->drawable.id;
...@@ -1027,6 +1028,7 @@ CrushTree(WindowPtr pWin) ...@@ -1027,6 +1028,7 @@ CrushTree(WindowPtr pWin)
pParent = pChild->parent; pParent = pChild->parent;
if (SubStrSend(pChild, pParent)) if (SubStrSend(pChild, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = DestroyNotify; event.u.u.type = DestroyNotify;
event.u.destroyNotify.window = pChild->drawable.id; event.u.destroyNotify.window = pChild->drawable.id;
DeliverEvents(pChild, &event, 1, NullWindow); DeliverEvents(pChild, &event, 1, NullWindow);
...@@ -1076,6 +1078,7 @@ DeleteWindow(pointer value, XID wid) ...@@ -1076,6 +1078,7 @@ DeleteWindow(pointer value, XID wid)
pParent = pWin->parent; pParent = pWin->parent;
if (wid && pParent && SubStrSend(pWin, pParent)) if (wid && pParent && SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = DestroyNotify; event.u.u.type = DestroyNotify;
event.u.destroyNotify.window = pWin->drawable.id; event.u.destroyNotify.window = pWin->drawable.id;
DeliverEvents(pWin, &event, 1, NullWindow); DeliverEvents(pWin, &event, 1, NullWindow);
...@@ -2562,6 +2565,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP ...@@ -2562,6 +2565,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
#endif #endif
)) ))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ConfigureRequest; event.u.u.type = ConfigureRequest;
event.u.configureRequest.window = pWin->drawable.id; event.u.configureRequest.window = pWin->drawable.id;
if (mask & CWSibling) if (mask & CWSibling)
...@@ -2606,6 +2610,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP ...@@ -2606,6 +2610,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask)) if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask))
{ {
xEvent eventT; xEvent eventT;
memset(&eventT, 0, sizeof(xEvent));
eventT.u.u.type = ResizeRequest; eventT.u.u.type = ResizeRequest;
eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.window = pWin->drawable.id;
eventT.u.resizeRequest.width = w; eventT.u.resizeRequest.width = w;
...@@ -2652,6 +2657,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP ...@@ -2652,6 +2657,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
ActuallyDoSomething: ActuallyDoSomething:
if (SubStrSend(pWin, pParent)) if (SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ConfigureNotify; event.u.u.type = ConfigureNotify;
event.u.configureNotify.window = pWin->drawable.id; event.u.configureNotify.window = pWin->drawable.id;
if (pSib) if (pSib)
...@@ -2825,6 +2831,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, ...@@ -2825,6 +2831,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent,
if (WasMapped) if (WasMapped)
UnmapWindow(pWin, FALSE); UnmapWindow(pWin, FALSE);
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ReparentNotify; event.u.u.type = ReparentNotify;
event.u.reparent.window = pWin->drawable.id; event.u.reparent.window = pWin->drawable.id;
event.u.reparent.parent = pParent->drawable.id; event.u.reparent.parent = pParent->drawable.id;
...@@ -2996,6 +3003,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client) ...@@ -2996,6 +3003,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
#endif #endif
)) ))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapRequest; event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.window = pWin->drawable.id;
#ifdef XAPPGROUP #ifdef XAPPGROUP
...@@ -3018,6 +3026,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client) ...@@ -3018,6 +3026,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
pWin->mapped = TRUE; pWin->mapped = TRUE;
if (SubStrSend(pWin, pParent)) if (SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapNotify; event.u.u.type = MapNotify;
event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.window = pWin->drawable.id;
event.u.mapNotify.override = pWin->overrideRedirect; event.u.mapNotify.override = pWin->overrideRedirect;
...@@ -3110,6 +3119,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client) ...@@ -3110,6 +3119,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client)
{ {
if (parentRedirect && !pWin->overrideRedirect) if (parentRedirect && !pWin->overrideRedirect)
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapRequest; event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.window = pWin->drawable.id;
event.u.mapRequest.parent = pParent->drawable.id; event.u.mapRequest.parent = pParent->drawable.id;
...@@ -3122,6 +3132,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client) ...@@ -3122,6 +3132,7 @@ MapSubwindows(register WindowPtr pParent, ClientPtr client)
pWin->mapped = TRUE; pWin->mapped = TRUE;
if (parentNotify || StrSend(pWin)) if (parentNotify || StrSend(pWin))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapNotify; event.u.u.type = MapNotify;
event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.window = pWin->drawable.id;
event.u.mapNotify.override = pWin->overrideRedirect; event.u.mapNotify.override = pWin->overrideRedirect;
...@@ -3283,6 +3294,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure) ...@@ -3283,6 +3294,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
return(Success); return(Success);
if (SubStrSend(pWin, pParent)) if (SubStrSend(pWin, pParent))
{ {
memset(&event, 0, sizeof(xEvent));
event.u.u.type = UnmapNotify; event.u.u.type = UnmapNotify;
event.u.unmapNotify.window = pWin->drawable.id; event.u.unmapNotify.window = pWin->drawable.id;
event.u.unmapNotify.fromConfigure = fromConfigure; event.u.unmapNotify.fromConfigure = fromConfigure;
...@@ -3577,6 +3589,7 @@ SendVisibilityNotify(WindowPtr pWin) ...@@ -3577,6 +3589,7 @@ SendVisibilityNotify(WindowPtr pWin)
} }
#endif #endif
memset(&event, 0, sizeof(xEvent));
event.u.u.type = VisibilityNotify; event.u.u.type = VisibilityNotify;
event.u.visibility.window = pWin->drawable.id; event.u.visibility.window = pWin->drawable.id;
event.u.visibility.state = visibility; event.u.visibility.state = visibility;
......
...@@ -420,6 +420,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) ...@@ -420,6 +420,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
else else
{ {
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = NoExpose; event.u.u.type = NoExpose;
event.u.noExposure.drawable = drawable; event.u.noExposure.drawable = drawable;
event.u.noExposure.majorEvent = major; event.u.noExposure.majorEvent = major;
...@@ -445,6 +446,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -445,6 +446,7 @@ miSendExposures(pWin, pRgn, dx, dy)
numRects = REGION_NUM_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn);
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
return; return;
memset(pEvent, 0, numRects * sizeof(xEvent));
for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
{ {
......
...@@ -125,6 +125,8 @@ RRCloseScreen (int i, ScreenPtr pScreen) ...@@ -125,6 +125,8 @@ RRCloseScreen (int i, ScreenPtr pScreen)
for (j = pScrPriv->numOutputs - 1; j >= 0; j--) for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
RROutputDestroy (pScrPriv->outputs[j]); RROutputDestroy (pScrPriv->outputs[j]);
xfree (pScrPriv->crtcs);
xfree (pScrPriv->outputs);
xfree (pScrPriv); xfree (pScrPriv);
RRNScreens -= 1; /* ok, one fewer screen with RandR running */ RRNScreens -= 1; /* ok, one fewer screen with RandR running */
return (*pScreen->CloseScreen) (i, pScreen); return (*pScreen->CloseScreen) (i, pScreen);
......
...@@ -642,7 +642,6 @@ ProcRRSetCrtcConfig (ClientPtr client) ...@@ -642,7 +642,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
int numOutputs; int numOutputs;
RROutputPtr *outputs = NULL; RROutputPtr *outputs = NULL;
RROutput *outputIds; RROutput *outputIds;
TimeStamp configTime;
TimeStamp time; TimeStamp time;
Rotation rotation; Rotation rotation;
int i, j; int i, j;
...@@ -745,7 +744,6 @@ ProcRRSetCrtcConfig (ClientPtr client) ...@@ -745,7 +744,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
time = ClientTimeToServerTime(stuff->timestamp); time = ClientTimeToServerTime(stuff->timestamp);
configTime = ClientTimeToServerTime(stuff->configTimestamp);
if (!pScrPriv) if (!pScrPriv)
{ {
...@@ -754,19 +752,6 @@ ProcRRSetCrtcConfig (ClientPtr client) ...@@ -754,19 +752,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
goto sendReply; goto sendReply;
} }
#if 0
/*
* if the client's config timestamp is not the same as the last config
* timestamp, then the config information isn't up-to-date and
* can't even be validated
*/
if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0)
{
rep.status = RRSetConfigInvalidConfigTime;
goto sendReply;
}
#endif
/* /*
* Validate requested rotation * Validate requested rotation
*/ */
...@@ -853,10 +838,8 @@ ProcRRSetCrtcConfig (ClientPtr client) ...@@ -853,10 +838,8 @@ ProcRRSetCrtcConfig (ClientPtr client)
rep.status = RRSetConfigFailed; rep.status = RRSetConfigFailed;
goto sendReply; goto sendReply;
} }
#ifdef NXAGENT_SERVER /* Bug 21987 */
pScrPriv->lastSetTime = time;
#endif
rep.status = RRSetConfigSuccess; rep.status = RRSetConfigSuccess;
pScrPriv->lastSetTime = time;
sendReply: sendReply:
if (outputs) if (outputs)
...@@ -866,11 +849,7 @@ sendReply: ...@@ -866,11 +849,7 @@ sendReply:
/* rep.status has already been filled in */ /* rep.status has already been filled in */
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
#ifndef NXAGENT_SERVER /* Bug 21987 */
rep.newTimestamp = pScrPriv->lastConfigTime.milliseconds;
#else
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
#endif
if (client->swapped) if (client->swapped)
{ {
......
...@@ -83,6 +83,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) ...@@ -83,6 +83,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
int i; int i;
CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT; CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
CARD16 maxWidth = 0, maxHeight = 0; CARD16 maxWidth = 0, maxHeight = 0;
CARD16 width, height;
/* /*
* First time through, create a crtc and output and hook * First time through, create a crtc and output and hook
...@@ -153,11 +154,11 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) ...@@ -153,11 +154,11 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
/* find size bounds */ /* find size bounds */
for (i = 0; i < output->numModes + output->numUserModes; i++) for (i = 0; i < output->numModes + output->numUserModes; i++)
{ {
RRModePtr mode = (i < output->numModes ? mode = (i < output->numModes ?
output->modes[i] : output->modes[i] :
output->userModes[i-output->numModes]); output->userModes[i-output->numModes]);
CARD16 width = mode->mode.width; width = mode->mode.width;
CARD16 height = mode->mode.height; height = mode->mode.height;
if (width < minWidth) minWidth = width; if (width < minWidth) minWidth = width;
if (width > maxWidth) maxWidth = width; if (width > maxWidth) maxWidth = width;
......
...@@ -98,8 +98,10 @@ RRModeCreate (xRRModeInfo *modeInfo, ...@@ -98,8 +98,10 @@ RRModeCreate (xRRModeInfo *modeInfo,
} }
mode->mode.id = FakeClientID(0); mode->mode.id = FakeClientID(0);
if (!AddResource (mode->mode.id, RRModeType, (pointer) mode)) if (!AddResource(mode->mode.id, RRModeType, (pointer) mode)) {
free(newModes);
return NULL; return NULL;
}
modes = newModes; modes = newModes;
modes[num_modes++] = mode; modes[num_modes++] = mode;
...@@ -192,7 +194,7 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret) ...@@ -192,7 +194,7 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
for (o = 0; o < pScrPriv->numOutputs; o++) for (o = 0; o < pScrPriv->numOutputs; o++)
{ {
RROutputPtr output = pScrPriv->outputs[o]; RROutputPtr output = pScrPriv->outputs[o];
int m, n; int n;
for (m = 0; m < output->numModes + output->numUserModes; m++) for (m = 0; m < output->numModes + output->numUserModes; m++)
{ {
...@@ -297,7 +299,6 @@ ProcRRCreateMode (ClientPtr client) ...@@ -297,7 +299,6 @@ ProcRRCreateMode (ClientPtr client)
xRRCreateModeReply rep; xRRCreateModeReply rep;
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
xRRModeInfo *modeInfo; xRRModeInfo *modeInfo;
long units_after; long units_after;
char *name; char *name;
...@@ -315,7 +316,6 @@ ProcRRCreateMode (ClientPtr client) ...@@ -315,7 +316,6 @@ ProcRRCreateMode (ClientPtr client)
return rc; return rc;
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
modeInfo = &stuff->modeInfo; modeInfo = &stuff->modeInfo;
name = (char *) (stuff + 1); name = (char *) (stuff + 1);
...@@ -342,7 +342,8 @@ ProcRRCreateMode (ClientPtr client) ...@@ -342,7 +342,8 @@ ProcRRCreateMode (ClientPtr client)
swapl(&rep.mode, n); swapl(&rep.mode, n);
} }
WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep); WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
/* Drop out reference to this mode */
RRModeDestroy (mode);
return client->noClientException; return client->noClientException;
} }
......
...@@ -456,6 +456,7 @@ ProcRRGetOutputInfo (ClientPtr client) ...@@ -456,6 +456,7 @@ ProcRRGetOutputInfo (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
rep.type = X_Reply; rep.type = X_Reply;
rep.status = RRSetConfigSuccess;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = OutputInfoExtra >> 2; rep.length = OutputInfoExtra >> 2;
rep.timestamp = pScrPriv->lastSetTime.milliseconds; rep.timestamp = pScrPriv->lastSetTime.milliseconds;
......
...@@ -228,7 +228,7 @@ ProcRRGetScreenSizeRange (ClientPtr client) ...@@ -228,7 +228,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
int rc; int rc;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
#ifndef NXAGENT_SERVER #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
#else #else
...@@ -677,8 +677,9 @@ ProcRRGetScreenInfo (ClientPtr client) ...@@ -677,8 +677,9 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.sizeID = pData->size; rep.sizeID = pData->size;
rep.rate = pData->refresh; rep.rate = pData->refresh;
extraLen = (rep.nSizes * sizeof (xScreenSizes) + extraLen = rep.nSizes * sizeof (xScreenSizes);
rep.nrateEnts * sizeof (CARD16)); if (has_rate)
extraLen += rep.nrateEnts * sizeof (CARD16);
if (extraLen) if (extraLen)
{ {
...@@ -744,6 +745,7 @@ ProcRRGetScreenInfo (ClientPtr client) ...@@ -744,6 +745,7 @@ ProcRRGetScreenInfo (ClientPtr client)
swaps(&rep.sequenceNumber, n); swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n); swapl(&rep.length, n);
swapl(&rep.timestamp, n); swapl(&rep.timestamp, n);
swapl(&rep.configTimestamp, n);
swaps(&rep.rotation, n); swaps(&rep.rotation, n);
swaps(&rep.nSizes, n); swaps(&rep.nSizes, n);
swaps(&rep.sizeID, n); swaps(&rep.sizeID, n);
...@@ -938,6 +940,18 @@ ProcRRSetScreenConfig (ClientPtr client) ...@@ -938,6 +940,18 @@ ProcRRSetScreenConfig (ClientPtr client)
width = mode->mode.height; width = mode->mode.height;
height = mode->mode.width; height = mode->mode.width;
} }
if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) {
client->errorValue = width;
free(pData);
return BadValue;
}
if (height < pScrPriv->minHeight || pScrPriv->maxHeight < height) {
client->errorValue = height;
free(pData);
return BadValue;
}
if (width != pScreen->width || height != pScreen->height) if (width != pScreen->width || height != pScreen->height)
{ {
int c; int c;
...@@ -963,15 +977,10 @@ ProcRRSetScreenConfig (ClientPtr client) ...@@ -963,15 +977,10 @@ ProcRRSetScreenConfig (ClientPtr client)
if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output)) if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output))
rep.status = RRSetConfigFailed; rep.status = RRSetConfigFailed;
#ifndef NXAGENT_SERVER /* Bug 21987 */
else
rep.status = RRSetConfigSuccess;
#else
else { else {
rep.status = RRSetConfigSuccess;
pScrPriv->lastSetTime = time; pScrPriv->lastSetTime = time;
rep.status = RRSetConfigSuccess;
} }
#endif
/* /*
* XXX Configure other crtcs to mirror as much as possible * XXX Configure other crtcs to mirror as much as possible
......
...@@ -282,6 +282,7 @@ ProcRRXineramaIsActive(ClientPtr client) ...@@ -282,6 +282,7 @@ ProcRRXineramaIsActive(ClientPtr client)
REQUEST_SIZE_MATCH(xXineramaIsActiveReq); REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
memset(&rep, 0, sizeof(xXineramaIsActiveReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -288,6 +288,7 @@ ProcRenderQueryVersion (ClientPtr client) ...@@ -288,6 +288,7 @@ ProcRenderQueryVersion (ClientPtr client)
pRenderClient->major_version = stuff->majorVersion; pRenderClient->major_version = stuff->majorVersion;
pRenderClient->minor_version = stuff->minorVersion; pRenderClient->minor_version = stuff->minorVersion;
memset(&rep, 0, sizeof(xRenderQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -410,6 +411,8 @@ ProcRenderQueryPictFormats (ClientPtr client) ...@@ -410,6 +411,8 @@ ProcRenderQueryPictFormats (ClientPtr client)
reply = (xRenderQueryPictFormatsReply *) xalloc (rlength); reply = (xRenderQueryPictFormatsReply *) xalloc (rlength);
if (!reply) if (!reply)
return BadAlloc; return BadAlloc;
memset(reply, 0, rlength);
reply->type = X_Reply; reply->type = X_Reply;
reply->sequenceNumber = client->sequence; reply->sequenceNumber = client->sequence;
reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->length = (rlength - sizeof(xGenericReply)) >> 2;
......
...@@ -84,6 +84,8 @@ XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args) ...@@ -84,6 +84,8 @@ XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args)
{ {
xXFixesSelectionNotifyEvent ev; xXFixesSelectionNotifyEvent ev;
memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
ev.type = XFixesEventBase + XFixesSelectionNotify; ev.type = XFixesEventBase + XFixesSelectionNotify;
ev.subtype = subtype; ev.subtype = subtype;
ev.sequenceNumber = e->pClient->sequence; ev.sequenceNumber = e->pClient->sequence;
......
...@@ -42,6 +42,7 @@ ProcXFixesQueryVersion(ClientPtr client) ...@@ -42,6 +42,7 @@ ProcXFixesQueryVersion(ClientPtr client)
REQUEST(xXFixesQueryVersionReq); REQUEST(xXFixesQueryVersionReq);
REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
memset(&rep, 0, sizeof(xXFixesQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -192,6 +192,7 @@ ProcXkbUseExtension(ClientPtr client) ...@@ -192,6 +192,7 @@ ProcXkbUseExtension(ClientPtr client)
stuff->wantedMajor,stuff->wantedMinor, stuff->wantedMajor,stuff->wantedMinor,
XkbMajorVersion,XkbMinorVersion); XkbMajorVersion,XkbMinorVersion);
} }
memset(&rep, 0, sizeof(xkbUseExtensionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.supported = supported; rep.supported = supported;
rep.length = 0; rep.length = 0;
...@@ -1313,6 +1314,8 @@ char *desc,*start; ...@@ -1313,6 +1314,8 @@ char *desc,*start;
start= desc= (char *)ALLOCATE_LOCAL(len); start= desc= (char *)ALLOCATE_LOCAL(len);
if (!start) if (!start)
return BadAlloc; return BadAlloc;
memset(start, 0, len);
if ( rep->nTypes>0 ) if ( rep->nTypes>0 )
desc = XkbWriteKeyTypes(xkb,rep,desc,client); desc = XkbWriteKeyTypes(xkb,rep,desc,client);
if ( rep->nKeySyms>0 ) if ( rep->nKeySyms>0 )
...@@ -2381,6 +2384,8 @@ ProcXkbSetMap(ClientPtr client) ...@@ -2381,6 +2384,8 @@ ProcXkbSetMap(ClientPtr client)
(xkb->max_key_code!=stuff->maxKeyCode)) { (xkb->max_key_code!=stuff->maxKeyCode)) {
Status status; Status status;
xkbNewKeyboardNotify nkn; xkbNewKeyboardNotify nkn;
memset(&nkn, 0, sizeof(xkbNewKeyboardNotify));
nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.deviceID= nkn.oldDeviceID= dev->id;
nkn.oldMinKeyCode= xkb->min_key_code; nkn.oldMinKeyCode= xkb->min_key_code;
nkn.oldMaxKeyCode= xkb->max_key_code; nkn.oldMaxKeyCode= xkb->max_key_code;
...@@ -3480,6 +3485,7 @@ ProcXkbGetNames(ClientPtr client) ...@@ -3480,6 +3485,7 @@ ProcXkbGetNames(ClientPtr client)
CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask); CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
xkb = dev->key->xkbInfo->desc; xkb = dev->key->xkbInfo->desc;
memset(&rep, 0, sizeof(xkbGetNamesReply));
rep.type= X_Reply; rep.type= X_Reply;
rep.sequenceNumber= client->sequence; rep.sequenceNumber= client->sequence;
rep.length = 0; rep.length = 0;
...@@ -4939,6 +4945,7 @@ ProcXkbSetGeometry(ClientPtr client) ...@@ -4939,6 +4945,7 @@ ProcXkbSetGeometry(ClientPtr client)
nn.changed= XkbGeometryNameMask; nn.changed= XkbGeometryNameMask;
XkbSendNamesNotify(dev,&nn); XkbSendNamesNotify(dev,&nn);
} }
memset(&nkn, 0, sizeof(xkbNewKeyboardNotify));
nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.deviceID= nkn.oldDeviceID= dev->id;
nkn.minKeyCode= nkn.oldMinKeyCode= xkb->min_key_code; nkn.minKeyCode= nkn.oldMinKeyCode= xkb->min_key_code;
nkn.maxKeyCode= nkn.oldMaxKeyCode= xkb->max_key_code; nkn.maxKeyCode= nkn.oldMaxKeyCode= xkb->max_key_code;
...@@ -4969,6 +4976,7 @@ ProcXkbPerClientFlags(ClientPtr client) ...@@ -4969,6 +4976,7 @@ ProcXkbPerClientFlags(ClientPtr client)
CHK_MASK_MATCH(0x02,stuff->change,stuff->value); CHK_MASK_MATCH(0x02,stuff->change,stuff->value);
interest = XkbFindClientResource((DevicePtr)dev,client); interest = XkbFindClientResource((DevicePtr)dev,client);
memset(&rep, 0, sizeof(xkbPerClientFlagsReply));
rep.type= X_Reply; rep.type= X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
...@@ -5463,6 +5471,7 @@ ProcXkbGetKbdByName(ClientPtr client) ...@@ -5463,6 +5471,7 @@ ProcXkbGetKbdByName(ClientPtr client)
XkbFreeSrvLedInfo(old_sli); XkbFreeSrvLedInfo(old_sli);
} }
memset(&nkn, 0, sizeof(xkbNewKeyboardNotify));
nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.deviceID= nkn.oldDeviceID= dev->id;
nkn.minKeyCode= finfo.xkb->min_key_code; nkn.minKeyCode= finfo.xkb->min_key_code;
nkn.maxKeyCode= finfo.xkb->max_key_code; nkn.maxKeyCode= finfo.xkb->max_key_code;
......
...@@ -730,6 +730,7 @@ XkbSrvLedInfoPtr sli; ...@@ -730,6 +730,7 @@ XkbSrvLedInfoPtr sli;
} }
if (pChanges->map.changed) { if (pChanges->map.changed) {
xkbMapNotify mn; xkbMapNotify mn;
memset(&mn, 0, sizeof(xkbMapNotify));
mn.changed= pChanges->map.changed; mn.changed= pChanges->map.changed;
mn.firstType= pChanges->map.first_type; mn.firstType= pChanges->map.first_type;
mn.nTypes= pChanges->map.num_types; mn.nTypes= pChanges->map.num_types;
...@@ -751,6 +752,7 @@ XkbSrvLedInfoPtr sli; ...@@ -751,6 +752,7 @@ XkbSrvLedInfoPtr sli;
if ((pChanges->ctrls.changed_ctrls)|| if ((pChanges->ctrls.changed_ctrls)||
(pChanges->ctrls.enabled_ctrls_changes)) { (pChanges->ctrls.enabled_ctrls_changes)) {
xkbControlsNotify cn; xkbControlsNotify cn;
memset(&cn, 0, sizeof(xkbControlsNotify));
cn.changedControls= pChanges->ctrls.changed_ctrls; cn.changedControls= pChanges->ctrls.changed_ctrls;
cn.enabledControlChanges= pChanges->ctrls.enabled_ctrls_changes; cn.enabledControlChanges= pChanges->ctrls.enabled_ctrls_changes;
cn.keycode= cause->kc; cn.keycode= cause->kc;
...@@ -763,6 +765,7 @@ XkbSrvLedInfoPtr sli; ...@@ -763,6 +765,7 @@ XkbSrvLedInfoPtr sli;
xkbIndicatorNotify in; xkbIndicatorNotify in;
if (sli==NULL) if (sli==NULL)
sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0); sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0);
memset(&in, 0, sizeof(xkbIndicatorNotify));
in.state= sli->effectiveState; in.state= sli->effectiveState;
in.changed= pChanges->indicators.map_changes; in.changed= pChanges->indicators.map_changes;
XkbSendIndicatorNotify(kbd,XkbIndicatorMapNotify,&in); XkbSendIndicatorNotify(kbd,XkbIndicatorMapNotify,&in);
...@@ -771,12 +774,14 @@ XkbSrvLedInfoPtr sli; ...@@ -771,12 +774,14 @@ XkbSrvLedInfoPtr sli;
xkbIndicatorNotify in; xkbIndicatorNotify in;
if (sli==NULL) if (sli==NULL)
sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0); sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0);
memset(&in, 0, sizeof(xkbIndicatorNotify));
in.state= sli->effectiveState; in.state= sli->effectiveState;
in.changed= pChanges->indicators.state_changes; in.changed= pChanges->indicators.state_changes;
XkbSendIndicatorNotify(kbd,XkbIndicatorStateNotify,&in); XkbSendIndicatorNotify(kbd,XkbIndicatorStateNotify,&in);
} }
if (pChanges->names.changed) { if (pChanges->names.changed) {
xkbNamesNotify nn; xkbNamesNotify nn;
memset(&nn, 0, sizeof(xkbNamesNotify));
nn.changed= pChanges->names.changed; nn.changed= pChanges->names.changed;
nn.firstType= pChanges->names.first_type; nn.firstType= pChanges->names.first_type;
nn.nTypes= pChanges->names.num_types; nn.nTypes= pChanges->names.num_types;
...@@ -789,6 +794,7 @@ XkbSrvLedInfoPtr sli; ...@@ -789,6 +794,7 @@ XkbSrvLedInfoPtr sli;
} }
if ((pChanges->compat.changed_groups)||(pChanges->compat.num_si>0)) { if ((pChanges->compat.changed_groups)||(pChanges->compat.num_si>0)) {
xkbCompatMapNotify cmn; xkbCompatMapNotify cmn;
memset(&cmn, 0, sizeof(xkbCompatMapNotify));
cmn.changedGroups= pChanges->compat.changed_groups; cmn.changedGroups= pChanges->compat.changed_groups;
cmn.firstSI= pChanges->compat.first_si; cmn.firstSI= pChanges->compat.first_si;
cmn.nSI= pChanges->compat.num_si; cmn.nSI= pChanges->compat.num_si;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment