From b72ed1247a8b474092b08a52b0c27cc0597012f6 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Sun, 11 Sep 2016 17:50:57 +0530 Subject: [PATCH] rcfile: disallow rebinding more than one character long keys M-Space, ^Space, Ins and Del remain exception. Signed-off-by: Rishabh Dave --- src/rcfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rcfile.c b/src/rcfile.c index b078f03..c38f1b7 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -401,7 +401,10 @@ void parse_binding(char *ptr, bool dobind) else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') { rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\"")); goto free_copy; - } else if (keycopy[0] == '^' && (keycopy[1] < 64 || keycopy[1] > 127)) { + } else if ((keycopy[0] == '^' && ((keycopy[1] < 64 || keycopy[1] > 127) || + (strlen(keycopy) > 2 && strcmp(keycopy, "^Space") != 0))) || + (strlen(keycopy) > 3 && strcmp(keycopy, "^Space") != 0 && + strcmp(keycopy, "M-Space") != 0)) { rcfile_error(N_("Key name %s is invalid"), keycopy); goto free_copy; } -- 2.7.4