GrabDevice() needs to handle NULL return value from AllocGrab()
GrabDevice() calls AllocGrab() which can fail and return NULL. This return value is not checked, and can cause NULL pointer dereferences. Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
3a113815a0
commit
5493a67ec2
|
@ -5051,7 +5051,7 @@ ProcUngrabPointer(ClientPtr client)
|
||||||
* @param other_mode GrabModeSync or GrabModeAsync
|
* @param other_mode GrabModeSync or GrabModeAsync
|
||||||
* @param status Return code to be returned to the caller.
|
* @param status Return code to be returned to the caller.
|
||||||
*
|
*
|
||||||
* @returns Success or BadValue.
|
* @returns Success or BadValue or BadAlloc.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
||||||
|
@ -5132,6 +5132,8 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
||||||
GrabPtr tempGrab;
|
GrabPtr tempGrab;
|
||||||
|
|
||||||
tempGrab = AllocGrab(NULL);
|
tempGrab = AllocGrab(NULL);
|
||||||
|
if (tempGrab == NULL)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
tempGrab->next = NULL;
|
tempGrab->next = NULL;
|
||||||
tempGrab->window = pWin;
|
tempGrab->window = pWin;
|
||||||
|
|
Loading…
Reference in New Issue