summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2015-04-09 16:30:01 -0700
committerJason Gerecke <killertofu@gmail.com>2015-04-28 10:44:30 -0700
commitc7db2dab7bc803ee84bfec1d8a90e1e608b6cb09 (patch)
tree507a3cedc23adaa348407ba9fc71cd3e2d9da3e2 /tools
parent162cf8d54e8858b8c1cbc96c49f4ffa73716b7e8 (diff)
downloadxf86-input-wacom-c7db2dab7bc803ee84bfec1d8a90e1e608b6cb09.tar.gz
afl: xsetwacom: Do not allow negative button numbers
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.jgerecke@wacom.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/xsetwacom.c4
1 files 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;