Check for calloc() failure in add_master()

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Alan Coopersmith 2014-01-24 23:42:49 -08:00 committed by Peter Hutterer
parent 76b3be75b6
commit 9fc19168e7

View File

@ -143,6 +143,10 @@ add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES])
int rc;
name = calloc(c->name_len + 1, sizeof(char));
if (name == NULL) {
rc = BadAlloc;
goto unwind;
}
strncpy(name, (char *) &c[1], c->name_len);
rc = AllocDevicePair(client, name, &ptr, &keybd,