summaryrefslogtreecommitdiff
path: root/ltunify.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 /ltunify.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 'ltunify.c')
-rw-r--r--ltunify.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ltunify.c b/ltunify.c
index e972618..96447b4 100644
--- a/ltunify.c
+++ b/ltunify.c
@@ -197,7 +197,7 @@ struct device {
struct device devices[DEVICES_MAX];
// error messages for type=8F (ERROR_MSG)
-static const char * error_messages[0xFF] = {
+static const char * error_messages[0x100] = {
[0x01] = "SUCCESS",
[0x02] = "INVALID_SUBID",
[0x03] = "INVALID_ADDRESS",
@@ -213,7 +213,7 @@ static const char * error_messages[0xFF] = {
[0x0d] = "WRONG_PIN_CODE",
};
-static const char * device_type[0x0F] = {
+static const char * device_type[0x10] = {
[0x00] = "Unknown",
[0x01] = "Keyboard",
[0x02] = "Mouse",