From: Markus Koschany Date: Wed, 2 Nov 2022 22:34:23 +0100 Subject: CVE-2022-2285 Origin: https://github.com/vim/vim/commit/27efc62f5d86afcb2ecb7565587fe8dea4b036fe --- src/term.c | 1 + src/testdir/test_mapping.vim | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/term.c b/src/term.c index 47d2bda..bc46ed9 100644 --- a/src/term.c +++ b/src/term.c @@ -4440,6 +4440,7 @@ check_termcode( if (*tp == ESC && !p_ek && (State & INSERT)) continue; + tp[len] = NUL; key_name[0] = NUL; /* no key name found yet */ key_name[1] = NUL; /* no key name found yet */ modifiers = 0; /* no modifiers yet */ diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index c454fc0..3c81bb5 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -318,3 +318,13 @@ func Test_motionforce_omap() delfunc Select delfunc GetCommand endfunc + +func Test_using_past_typeahead() + nnoremap :00 0 + exe "norm :set \x80\xfb0=0\" + exe "sil norm :0\x0f\\" + + exe "norm :set \x80\xfb0=\" + nunmap :00 +endfunc +