summaryrefslogtreecommitdiffstats
path: root/cgram/cgram.c
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2021-02-21 16:37:26 +0000
committerCameron Katri <me@cameronkatri.com>2021-04-13 15:28:32 -0400
commitb4408559c1e6e0df3ce61a198f9a4d1f444ecb87 (patch)
treeb6796b53f7b11dd3c5ec2c31750fab509cb04cf9 /cgram/cgram.c
parented695539f2c9b4aefd9f42852aa112ade4da7102 (diff)
downloadbsdgames-darwin-b4408559c1e6e0df3ce61a198f9a4d1f444ecb87.tar.gz
bsdgames-darwin-b4408559c1e6e0df3ce61a198f9a4d1f444ecb87.tar.zst
bsdgames-darwin-b4408559c1e6e0df3ce61a198f9a4d1f444ecb87.zip
cgram: fix undefined behavior when pressing function keys
The key codes for function keys are outside of the "range representable by an unsigned char". This resulted in parts of the screen being cleaned.
Diffstat (limited to 'cgram/cgram.c')
-rw-r--r--cgram/cgram.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgram/cgram.c b/cgram/cgram.c
index 7eaf592d..98f8bece 100644
--- a/cgram/cgram.c
+++ b/cgram/cgram.c
@@ -325,7 +325,7 @@ loop(void)
done = true;
break;
default:
- if (isalpha(ch)) {
+ if (isascii(ch) && isalpha(ch)) {
if (substitute(ch)) {
if (curx < strlen(lines.v[cury])) {
curx++;