[PATCH] Check for calloc() failure in add_master()
walter harms
wharms at bfs.de
Sat Jan 25 01:32:41 PST 2014
Am 25.01.2014 08:42, schrieb Alan Coopersmith:
> Reported-by: Ilja Van Sprundel <ivansprundel at ioactive.com>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> 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,
can you use strdup() here ?
re,
wh
More information about the xorg-devel
mailing list