Currently its possible to provide a negative (or zero) button number
on the commandline, which will be dutifully translated into a negative
offset. Detect this and throw an error if encountered.

Signed-off-by: Jason Gerecke <jason.jgere...@wacom.com>
---
 tools/xsetwacom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index e9d455b..96636e2 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1510,7 +1510,7 @@ static void map_actions(Display *dpy, XDevice *dev, 
param_t* param, int argc, ch
 
        if (strcmp(param->prop_name, WACOM_PROP_BUTTON_ACTIONS) == 0)
        {
-               if (sscanf(argv[0], "%d", &offset) != 1)
+               if (sscanf(argv[0], "%d", &offset) != 1 || offset <= 0)
                {
                        fprintf(stderr, "'%s' is not a valid button number.\n", 
argv[0]);
                        return;
@@ -2101,7 +2101,7 @@ static void get_map(Display *dpy, XDevice *dev, param_t 
*param, int argc, char**
 
        if (strcmp(param->prop_name, WACOM_PROP_BUTTON_ACTIONS) == 0)
        {
-               if (sscanf(argv[0], "%d", &offset) != 1)
+               if (sscanf(argv[0], "%d", &offset) != 1 || offset <= 0)
                {
                        fprintf(stderr, "'%s' is not a valid button number.\n", 
argv[0]);
                        return;
-- 
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

Reply via email to