Re: visudo edit wrong file
"Todd C. Miller" <[email protected]>
| Newsgroups | gmane.comp.tools.sudo.devel |
|---|---|
| Message-ID | <[email protected]> |
Confirmed. This bug was introduced in 1.8.14 with the refactoring
of the editing code. The patch below will work around the issue.
For sudo 1.8.15 I'm going to rearrange things a bit to make this
unnecessary.
- todd
diff -r 2b3efe0a91f2 plugins/sudoers/visudo.c
--- a/plugins/sudoers/visudo.c Thu Sep 10 16:44:57 2015 -0600
+++ b/plugins/sudoers/visudo.c Tue Sep 15 09:26:35 2015 -0600
@@ -465,14 +465,15 @@
lineno = -1;
/*
- * We pre-allocated 2 extra spaces for "+n filename" in argv.
+ * The last 3 slots in the editor argv are: "-- +1 sudoers"
* Replace those placeholders with the real values.
*/
- ac = editor_argc - 2;
+ ac = editor_argc - 3;
if (lineno > 0) {
(void)snprintf(linestr, sizeof(linestr), "+%d", lineno);
editor_argv[ac++] = linestr;
}
+ editor_argv[ac++] = "--";
editor_argv[ac++] = sp->tpath;
editor_argv[ac++] = NULL;
____________________________________________________________
sudo-workers mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
http://www.sudo.ws/mailman/listinfo/sudo-workers