io: more guards against NULL filename (#7159)

References ac055d677a
References #4370
This commit is contained in:
Justin M. Keyes
2017-08-13 18:46:09 +02:00
committed by GitHub
parent 3c8d063786
commit d258ac8ed2
4 changed files with 8 additions and 1 deletions

View File

@@ -895,6 +895,7 @@ static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags)
{
// fname cannot be NameBuff, because it must have been allocated.
mf_set_fnames(mfp, fname);
assert(mfp->mf_fname != NULL);
/// Extra security check: When creating a swap file it really shouldn't
/// exist yet. If there is a symbolic link, this is most likely an attack.