mirror of
https://github.com/neovim/neovim.git
synced 2026-07-16 22:21:30 +00:00
Fix: Use an assert to make sure, an error message can be copied into buffer buf in mch_dirname().
The copied error message is NUL-terminated.
This commit is contained in:
committed by
Thiago de Arruda
parent
33eb031c01
commit
7f23ec398d
@@ -33,10 +33,12 @@ int mch_chdir(char *path) {
|
||||
*/
|
||||
int mch_dirname(char_u *buf, int len)
|
||||
{
|
||||
assert(buf && len);
|
||||
|
||||
int errno;
|
||||
if ((errno = uv_cwd((char *) buf, len)) != 0) {
|
||||
STRCPY(buf, uv_strerror(errno));
|
||||
return FAIL;
|
||||
if ((errno = uv_cwd((char *)buf, len)) != 0) {
|
||||
vim_strncpy(buf, (char_u *)uv_strerror(errno), len - 1);
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user