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 status Return code to be returned to the caller.
|
||||
*
|
||||
* @returns Success or BadValue.
|
||||
* @returns Success or BadValue or BadAlloc.
|
||||
*/
|
||||
int
|
||||
GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
||||
|
@ -5132,6 +5132,8 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
|||
GrabPtr tempGrab;
|
||||
|
||||
tempGrab = AllocGrab(NULL);
|
||||
if (tempGrab == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
tempGrab->next = NULL;
|
||||
tempGrab->window = pWin;
|
||||
|
|
Loading…
Reference in New Issue
Block a user