[PATCH:setxkbmap] Fix crash when when -device is specified without argument
Dirk Wallenstein
halsmit at t-online.de
Wed Jan 19 00:57:56 PST 2011
On Tue, Jan 18, 2011 at 10:35:59PM -0800, Alan Coopersmith wrote:
> From: Stuart Kreitman <stuart.kreitman at oracle.com>
>
> http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6971649
>
> Signed-off-by: Stuart Kreitman <stuart.kreitman at oracle.com>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> setxkbmap.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/setxkbmap.c b/setxkbmap.c
> index 338b06c..e812a9c 100644
> --- a/setxkbmap.c
> +++ b/setxkbmap.c
> @@ -397,7 +397,14 @@ parseArgs(int argc, char **argv)
> else if (streq(argv[i], "-config"))
> ok = setOptString(&i, argc, argv, CONFIG_NDX, FROM_CMD_LINE);
> else if (streq(argv[i], "-device"))
> - deviceSpec = atoi(argv[++i]); /* only allow device IDs, not names */
> + {
> + if ( ++i < argc ) {
> + deviceSpec = atoi(argv[i]); /* only allow device IDs, not names */
> + } else {
> + usage(argc, argv);
> + exit(-1);
> + }
> + }
> else if (streq(argv[i], "-display"))
> ok = setOptString(&i, argc, argv, DISPLAY_NDX, FROM_CMD_LINE);
> else if (streq(argv[i], "-geometry"))
> --
> 1.7.3.2
>
Reviewed-by: Dirk Wallenstein <halsmit at t-online.de>
--
Greetings,
Dirk
More information about the xorg-devel
mailing list