summaryrefslogtreecommitdiffstats
path: root/input/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'input/device.c')
-rw-r--r--input/device.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/input/device.c b/input/device.c
index 674a1c53..7cd595d0 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1291,11 +1291,12 @@ static int get_class(bdaddr_t *src, bdaddr_t *dst, uint32_t *cls)
if (!str)
return -ENOENT;
- *cls = strtol(str, NULL, 16);
+ if (sscanf(str, "%x", cls) != 1) {
+ free(str);
+ return -ENOENT;
+ }
free(str);
- if ((*cls == LONG_MIN) || (*cls == LONG_MAX))
- return -ERANGE;
return 0;
}