vim-patch:8.0.0355: using uninitialized memory when 'isfname' is empty (#8493)

Problem:    Using uninitialized memory when 'isfname' is empty.
Solution:   Don't call getpwnam() without an argument. (Dominique Pelle,
            closes vim/vim#1464)
187a4f2814
This commit is contained in:
Jan Edmund Lazo
2018-06-08 02:10:38 -04:00
committed by Justin M. Keyes
parent 4871f26c22
commit be68f218ff
3 changed files with 17 additions and 9 deletions

View File

@@ -76,7 +76,7 @@ char *os_get_user_directory(const char *name)
{
#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
struct passwd *pw;
if (name == NULL) {
if (name == NULL || *name == NUL) {
return NULL;
}
pw = getpwnam(name); // NOLINT(runtime/threadsafe_fn)