aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-02 02:30:21 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 15:27:57 +0100
commitfd58863eb62edddf688a71d73448934efa188241 (patch)
tree8aa5c2ae70cc104817a381025d47b8b8d84ef9e1 /src/nvim/option.c
parent2d151f7739a072ee7239cc44efec2b43c1b72679 (diff)
downloadrneovim-fd58863eb62edddf688a71d73448934efa188241.tar.gz
rneovim-fd58863eb62edddf688a71d73448934efa188241.tar.bz2
rneovim-fd58863eb62edddf688a71d73448934efa188241.zip
vim-patch:8.0.0703: illegal memory access with empty :doau command
Problem: Illegal memory access with empty :doau command. Solution: Check the event for being out of range. (James McCoy) https://github.com/vim/vim/commit/faf29d7f91477c25c85d9d7165d90e8d8f1c512e
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 0858637a9d..6b1bb2b8a3 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1498,6 +1498,7 @@ do_set (
char_u *newval;
char_u *origval = NULL;
char *saved_origval = NULL;
+ char *saved_newval = NULL;
unsigned newlen;
int comma;
int bs;
@@ -1793,10 +1794,10 @@ do_set (
if (!starting && origval != NULL && newval != NULL) {
// origval may be freed by
// did_set_string_option(), make a copy.
- saved_origval = xstrdup((char *) origval);
+ saved_origval = xstrdup((char *)origval);
// newval (and varp) may become invalid if the
// buffer is closed by autocommands.
- saved_newval = vim_strsave(newval);
+ saved_newval = xstrdup((char *)newval);
}
// Handle side effects, and set the global value for
@@ -2397,7 +2398,7 @@ static char *set_string_option(const int opt_idx, const char *const value,
*varp = s;
char *const saved_oldval = (starting ? NULL : xstrdup(oldval));
- char *const *saved_newval = (starting ? NULL : xstrdup(s));
+ char *const saved_newval = (starting ? NULL : xstrdup(s));
char *const r = (char *)did_set_string_option(
opt_idx, (char_u **)varp, (int)true, (char_u *)oldval, NULL, opt_flags);