diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-07-09 11:07:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-07-09 11:07:16 +0200 |
commit | faf29d7f91477c25c85d9d7165d90e8d8f1c512e (patch) | |
tree | 937fb2302b208788ad6e9dda3bf94dd2f290350b /src/fileio.c | |
parent | c577d813b7978345dec4310b2d8f5d5624a681f6 (diff) | |
download | vim-git-faf29d7f91477c25c85d9d7165d90e8d8f1c512e.tar.gz |
patch 8.0.0703: illegal memory access with empty :doau commandv8.0.0703
Problem: Illegal memory access with empty :doau command.
Solution: Check the event for being out of range. (James McCoy)
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c index 0f59d809d..cac866c5c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -8863,7 +8863,7 @@ do_doautocmd( /* * Loop over the events. */ - while (*arg && !VIM_ISWHITE(*arg)) + while (*arg && !ends_excmd(*arg) && !VIM_ISWHITE(*arg)) if (apply_autocmds_group(event_name2nr(arg, &arg), fname, NULL, TRUE, group, curbuf, NULL)) nothing_done = FALSE; @@ -9385,7 +9385,8 @@ apply_autocmds_group( * Quickly return if there are no autocommands for this event or * autocommands are blocked. */ - if (first_autopat[(int)event] == NULL || autocmd_blocked > 0) + if (event == NUM_EVENTS || first_autopat[(int)event] == NULL + || autocmd_blocked > 0) goto BYPASS_AU; /* @@ -9458,7 +9459,7 @@ apply_autocmds_group( { if (event == EVENT_COLORSCHEME || event == EVENT_OPTIONSET) autocmd_fname = NULL; - else if (fname != NULL && *fname != NUL) + else if (fname != NULL && !ends_excmd(*fname)) autocmd_fname = fname; else if (buf != NULL) autocmd_fname = buf->b_ffname; |