summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-11-10 22:19:05 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-11-10 22:19:05 -0500
commit5ce883daaafc69f83b01dac5db0647e9662a6e87 (patch)
tree4ea0e556c3943f59ad21090f39b15f2146937655
parent0f76e46e79748277a22303dae82dcb91c551863e (diff)
downloadbfs-5ce883daaafc69f83b01dac5db0647e9662a6e87.tar.xz
typo: Array bounds are exclusive, not inclusive
-rw-r--r--src/typo.c2
-rw-r--r--tests/bfs/high_byte.sh1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/typo.c b/src/typo.c
index 4012730..c16cab4 100644
--- a/src/typo.c
+++ b/src/typo.c
@@ -20,7 +20,7 @@
#include <string.h>
// Assume QWERTY layout for now
-static const int key_coords[UCHAR_MAX][3] = {
+static const int key_coords[UCHAR_MAX + 1][3] = {
['`'] = { 0, 0, 0},
['~'] = { 0, 0, 1},
['1'] = { 3, 0, 0},
diff --git a/tests/bfs/high_byte.sh b/tests/bfs/high_byte.sh
new file mode 100644
index 0000000..222f24b
--- /dev/null
+++ b/tests/bfs/high_byte.sh
@@ -0,0 +1 @@
+fail invoke_bfs -$'\xFF'