From 01c8ffd61f01fea781332bfc23dda4ec789296d8 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 11 Feb 2025 09:29:04 +0100 Subject: [PATCH] tweaks: avoid running tolower() on an out-of-range value Functions like tolower() expect characters in the range -1..255. Reference: https://savannah.gnu.org/bugs/?50289. The other occurrences of toupper(), tolower(), and isxdigit() that don't do a cast are fine, because the values of 'code' or 'keycode' are already guaranteed to be in range by the surrounding code. --- src/global.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global.c b/src/global.c index fb1c6db3..2a072e1d 100644 --- a/src/global.c +++ b/src/global.c @@ -507,7 +507,7 @@ functionptrtype func_from_key(const int keycode) * with Pico or to mimic 'less' and similar text viewers. */ functionptrtype interpret(const int keycode) { - if (!meta_key) { + if (!meta_key && keycode < 0x7F) { if (keycode == 'N') return do_findprevious; if (keycode == 'n')