Skip to content

Commit 083692d

Browse files
committed
patch 9.0.0009: going past the end of a menu item with only modifier
Problem: Going past the end of a menu item with only modifier. Solution: Check for NUL.
1 parent 83e1180 commit 083692d

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/message.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,8 +1820,8 @@ str2special(
18201820
*sp = str + 1;
18211821
}
18221822
else
1823-
// single-byte character or illegal byte
1824-
*sp = str + 1;
1823+
// single-byte character, NUL or illegal byte
1824+
*sp = str + (*str == NUL ? 0 : 1);
18251825

18261826
// Make special keys and C0 control characters in <> form, also <M-Space>.
18271827
// Use <Space> only for lhs of a mapping.

src/testdir/test_menu.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,17 @@ func Test_tmenu()
528528
tunmenu Test
529529
endfunc
530530

531+
func Test_only_modifier()
532+
exe "tmenu a.b \x80\xfc0"
533+
let exp =<< trim [TEXT]
534+
--- Menus ---
535+
500 a
536+
500 b
537+
t - <T-2-^@>
538+
[TEXT]
539+
call assert_equal(exp, split(execute('tmenu'), "\n"))
540+
541+
tunmenu a.b
542+
endfunc
543+
531544
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
9,
738740
/**/
739741
8,
740742
/**/

0 commit comments

Comments
 (0)