These functions access argv[0] before checking that argc is at least 1. In the interest of correctness, swap it around so that the check occurs before the dereference.
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com> --- tools/xsetwacom.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index 96636e2..372b9b5 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -2515,9 +2515,8 @@ out: static void set_output(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv) { int head_no; - int x, y; + int x, y, flags; unsigned int width, height; - int flags = XParseGeometry(argv[0], &x, &y, &width, &height); if (argc != param->arg_count) { @@ -2526,6 +2525,8 @@ static void set_output(Display *dpy, XDevice *dev, param_t *param, int argc, cha return; } + flags = XParseGeometry(argv[0], &x, &y, &width, &height); + if (MaskIsSet(flags, XValue|YValue|WidthValue|HeightValue)) set_output_area(dpy, dev, x, y, width, height); else if (strcasecmp(argv[0], "next") == 0) @@ -2585,14 +2586,14 @@ static void get(Display *dpy, enum printformat printformat, int argc, char **arg param_t *param; XDevice *dev = NULL; - TRACE("'get' requested for '%s'.\n", argv[0]); - if (argc < 2) { usage(); return; } + TRACE("'get' requested for '%s'.\n", argv[0]); + dev = find_device(dpy, argv[0]); if (!dev) { -- 2.3.5 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel