Skip to content

Commit 1c254b3

Browse files
committed
visudo: create temporary file as mod 0600 not 0700
This was due to a typo in the mode field when the temporary file was created. Noticed by Bjorn Baron of the sudo-rs project.
1 parent cb4e267 commit 1c254b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/sudoers/visudo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, int editor_argc,
499499
if (sp->tpath == NULL) {
500500
if (asprintf(&sp->tpath, "%s.tmp", sp->dpath) == -1)
501501
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
502-
tfd = open(sp->tpath, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU|S_IRUSR);
502+
tfd = open(sp->tpath, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
503503
if (tfd < 0)
504504
sudo_fatal("%s", sp->tpath);
505505

0 commit comments

Comments
 (0)