Navigation Menu

Skip to content

Commit

Permalink
Check for calloc() failure in add_master()
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit 9fc1916)
  • Loading branch information
alanc authored and whot committed Feb 19, 2014
1 parent f11c593 commit 157cc02
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Xi/xichangehierarchy.c
Expand Up @@ -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,
Expand Down

0 comments on commit 157cc02

Please sign in to comment.