aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Adam <victor.adam@cofelyineo-gdfsuez.com>2015-10-27 13:30:58 +0100
committerVictor Adam <victor.adam@cofelyineo-gdfsuez.com>2015-10-27 13:33:48 +0100
commit8848b5cef2da6a4ee0585a83fc315d20ca867884 (patch)
tree7ed160593be38f870adf5a9091ba6f53a3e886be
parent68e596856828e61a5fed5a515647509b0cd77100 (diff)
downloadrneovim-8848b5cef2da6a4ee0585a83fc315d20ca867884.tar.gz
rneovim-8848b5cef2da6a4ee0585a83fc315d20ca867884.tar.bz2
rneovim-8848b5cef2da6a4ee0585a83fc315d20ca867884.zip
option: fix off-by-one error when handling &directory
a8e18d9 introduced an off-by-one error that caused the last character of &directory to be ignored. This commit is a straightforward fix for that error. fixes #3519
-rw-r--r--src/nvim/memline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index aa3e0e0b1c..dbb24e67a1 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -3262,8 +3262,8 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname,
* Isolate a directory name from *dirp and put it in dir_name.
* First allocate some memory to put the directory name in.
*/
- const size_t dir_len = strlen(*dirp);
- dir_name = xmalloc(dir_len + 1);
+ const size_t dir_len = strlen(*dirp) + 1;
+ dir_name = xmalloc(dir_len);
(void)copy_option_part((char_u **) dirp, (char_u *) dir_name, dir_len, ",");
/*