mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
Merge pull request #3528 from Grimy/directory-last-char
option: fix off-by-one error when handling &directory
This commit is contained in:
@@ -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.
|
* Isolate a directory name from *dirp and put it in dir_name.
|
||||||
* First allocate some memory to put the directory name in.
|
* First allocate some memory to put the directory name in.
|
||||||
*/
|
*/
|
||||||
const size_t dir_len = strlen(*dirp);
|
const size_t dir_len = strlen(*dirp) + 1;
|
||||||
dir_name = xmalloc(dir_len + 1);
|
dir_name = xmalloc(dir_len);
|
||||||
(void)copy_option_part((char_u **) dirp, (char_u *) dir_name, dir_len, ",");
|
(void)copy_option_part((char_u **) dirp, (char_u *) dir_name, dir_len, ",");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user