summaryrefslogtreecommitdiff
path: root/hidraw.c
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-04-26 23:15:40 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-04-26 23:15:40 +0200
commit9e8da2dd01e21d43a5566df91d85c91fd64f72d1 (patch)
tree0c4e7c38b9b73b53982b065c0e2925f6075d730f /hidraw.c
parent13ade9eb5b9a8a5fe9e37f3a42fbdacbd35c05ce (diff)
downloadltunify-9e8da2dd01e21d43a5566df91d85c91fd64f72d1.tar.gz
Fix logic flaw in array bounds
Index 0xFF needs an array of size 0x100... This error was caught with Address Sanitizer while trying to iterate through all registers 0x00..0xFF.
Diffstat (limited to 'hidraw.c')
-rwxr-xr-xhidraw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hidraw.c b/hidraw.c
index f749d50..17eff9e 100755
--- a/hidraw.c
+++ b/hidraw.c
@@ -50,7 +50,7 @@ struct report {
};
} __attribute__((__packed__));
-static const char * report_types[0xFF] = {
+static const char * report_types[0x100] = {
// 0x00 - 0x3F HID reports
[0x01] = "KEYBOARD",
[0x02] = "MOUSE",
@@ -78,7 +78,7 @@ static const char * report_types[0xFF] = {
[0x8F] = "_ERROR_MSG",
};
-static const char * error_messages[0xFF] = {
+static const char * error_messages[0x100] = {
// error messages for type=8F (ERROR_MSG)
[0x01] = "SUCCESS",
[0x02] = "INVALID_SUBID",
@@ -96,7 +96,7 @@ static const char * error_messages[0xFF] = {
};
// everything with a '?' is guessed
-static const char * registers[0xFF] = {
+static const char * registers[0x100] = {
[0x00] = "ENABLED_NOTIFS",
[0x01] = "KBD_HAND_DETECT?",
[0x02] = "CONNECTION_STATE",