diff options
author | Jason Gerecke <killertofu@gmail.com> | 2015-04-09 16:30:01 -0700 |
---|---|---|
committer | Jason Gerecke <killertofu@gmail.com> | 2015-04-28 10:44:30 -0700 |
commit | c7db2dab7bc803ee84bfec1d8a90e1e608b6cb09 (patch) | |
tree | 507a3cedc23adaa348407ba9fc71cd3e2d9da3e2 /tools | |
parent | 162cf8d54e8858b8c1cbc96c49f4ffa73716b7e8 (diff) | |
download | xf86-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.c | 4 |
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; |