Making viminfo readable by other users is most likely not useful. To
prevent information leakage enforce mode 0600.

The race condition fixed in the previous patch could also cause
viminfo files readable by other uses. Enforcing mode 0600
restores the originally indented permissions.
---
 src/ex_cmds.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index cc50409cf..c250a784f 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1984,21 +1984,9 @@ write_viminfo(char_u *file, int forceit)
 #else
            int fd;
 
-           /* Use mch_open() to be able to use O_NOFOLLOW and set file
-            * protection:
-            * Unix: same as original file, but strip s-bit.  Reset umask to
-            * avoid it getting in the way.
-            * Others: r&w for user only. */
-# ifdef UNIX
-           umask_save = umask(0);
-           fd = mch_open((char *)tempname,
-                   O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW,
-                                      (int)((st_old.st_mode & 0777) | 0600));
-           (void)umask(umask_save);
-# else
+           /* Use mch_open() to be able to use O_NOFOLLOW. */
            fd = mch_open((char *)tempname,
                            O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600);
-# endif
            if (fd < 0)
                fp_out = NULL;
            else
-- 
2.15.0

-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui