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

Peter Hutterer peter.hutterer at who-t.net
Sun Apr 18 16:40:09 PDT 2010


On Fri, Apr 16, 2010 at 06:42:25PM +0300, Tiago Vignatti wrote:
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---
>  xkb/xkbout.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/xkb/xkbout.c b/xkb/xkbout.c
> index 68ede90..084d72b 100644
> --- a/xkb/xkbout.c
> +++ b/xkb/xkbout.c
> @@ -353,9 +353,12 @@ XkbClientMapPtr		map;
>  XkbServerMapPtr		srv;
>  Bool			showActions;
>  
> +    if (!xkb)
> +	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;
>      }
> -- 
> 1.6.0.4

you're skipping an error message here. Instead, just move the srv assignment
to before it's being used and coverity will shut up.

Cheers,
  Peter


More information about the xorg-devel mailing list