[PATCH] xkb: check for NULL pointer before dereferences it in XkbWriteXKBSymbols

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 20 15:20:12 PDT 2010


On Tue, Apr 20, 2010 at 04:31:24PM +0300, Tiago Vignatti wrote:
> move srv assignment to before it's being used. Also, check for xkb being nil.
> 
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---
> Alan, I had amend your correction.
> 
>  xkb/xkbout.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/xkb/xkbout.c b/xkb/xkbout.c
> index 68ede90..082c85e 100644
> --- a/xkb/xkbout.c
> +++ b/xkb/xkbout.c
> @@ -353,9 +353,13 @@ XkbClientMapPtr		map;
>  XkbServerMapPtr		srv;
>  Bool			showActions;
>  
> +    if (!xkb) {
> +	_XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
> +	return FALSE;
> +    }
> +
>      map= xkb->map;
> -    srv= xkb->server;
> -    if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) {
> +    if ((!map)||(!map->syms)||(!map->key_sym_map)) {
>  	_XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
>  	return FALSE;
>      }
> @@ -376,6 +380,7 @@ Bool			showActions;
>      }
>      if (tmp>0)
>  	fprintf(file,"\n");
> +    srv= xkb->server;
>      for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
>  	Bool	simple;
>  	if ((int)XkbKeyNumSyms(xkb,i)<1)
> -- 
> 1.6.0.4

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter


More information about the xorg-devel mailing list