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.
This commit is contained in:
Benno Schulenberg 2025-02-11 09:29:04 +01:00
parent 58c7358cb3
commit 01c8ffd61f

View File

@ -507,7 +507,7 @@ functionptrtype func_from_key(const int keycode)
* with Pico or to mimic 'less' and similar text viewers. */ * with Pico or to mimic 'less' and similar text viewers. */
functionptrtype interpret(const int keycode) functionptrtype interpret(const int keycode)
{ {
if (!meta_key) { if (!meta_key && keycode < 0x7F) {
if (keycode == 'N') if (keycode == 'N')
return do_findprevious; return do_findprevious;
if (keycode == 'n') if (keycode == 'n')