Commit e03f3922 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

Make XGetWindowProperty() always initialize returned values

Avoids memory corruption and other errors when callers access them without checking to see if XGetWindowProperty() returned an error value. Callers are still required to check for errors, this just reduces the damage when they don't. Reported-by: 's avatarIlja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarMatthieu Herrb <matthieu.herrb@laas.fr> Signed-off-by: 's avatarJulien Cristau <jcristau@debian.org> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent b2071058
......@@ -49,6 +49,13 @@ XGetWindowProperty(
register xGetPropertyReq *req;
xError error;
/* Always initialize return values, in case callers fail to initialize
them and fail to check the return code for an error. */
*actual_type = None;
*actual_format = 0;
*nitems = *bytesafter = 0L;
*prop = (unsigned char *) NULL;
LockDisplay(dpy);
GetReq (GetProperty, req);
req->window = w;
......@@ -65,7 +72,6 @@ XGetWindowProperty(
return (1); /* not Success */
}
*prop = (unsigned char *) NULL;
if (reply.propertyType != None) {
unsigned long nbytes, netbytes;
int format = reply.format;
......
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