nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 3bac3c4c78a3eea5384a864a16579cfa3ad7039a
parent acadf71b13aab21cbb324dbee3afca9ca8bbb0d4
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 11 Jul 2018 14:42:10 +0200

rcfile: reject things like "M-Del" and "^{" as invalid key names

This fixes https://savannah.gnu.org/bugs/?54274.

Diffstat:
Msrc/global.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -448,14 +448,14 @@ int keycode_from_string(const char *keystring) if (keystring[0] == '^') { if (strcasecmp(keystring, "^Space") == 0) return 0; - if (strlen(keystring) == 2) + if (keystring[1] <= '_' && strlen(keystring) == 2) return keystring[1] - 64; else return -1; } else if (keystring[0] == 'M') { if (strcasecmp(keystring, "M-Space") == 0) return (int)' '; - if (keystring[1] == '-') + if (keystring[1] == '-' && strlen(keystring) == 3) return tolower((unsigned char)keystring[2]); else return -1;