[PATCH] Check for calloc() failure in add_master()
Peter Hutterer
peter.hutterer at who-t.net
Sat Jan 25 00:53:29 PST 2014
On Fri, Jan 24, 2014 at 11:42:49PM -0800, Alan Coopersmith wrote:
> Reported-by: Ilja Van Sprundel <ivansprundel at ioactive.com>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
merged, thanks
Cheers,
Peter
> Xi/xichangehierarchy.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
> index e2f4b8a..9e36354 100644
> --- a/Xi/xichangehierarchy.c
> +++ b/Xi/xichangehierarchy.c
> @@ -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,
> --
> 1.7.9.2
>
More information about the xorg-devel
mailing list