Bug 75 - visudo fails if $EDITOR set
visudo fails if $EDITOR set
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Visudo
1.6.4
All All
: normal normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-04-03 07:34 MST by Henrik Ahlgren
Modified: 2002-04-03 11:40 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Ahlgren 2002-04-03 07:34:32 MST
If env-editor is not defined and EDITOR environment
variable is set to a valid editor (/usr/bin/vi), visudo
fails with the following error:

visudo: unable to run  : No such file or directory
visudo: sudoers file unchanged.

This happens because Editor points to a EditorPath
after it has been free'ed. Here's a patch that fixes
this bug.

--- visudo.c    Fri Dec 14 21:52:48 200
+++ visudo.c.pablo      Wed Apr  3 17:26:45 2002
@@ -315,6 +315,7 @@
                    && (editor_sb.st_mode & 0000111) &&
                    editor_sb.st_dev == user_editor_sb.st_dev &&
                    editor_sb.st_ino == user_editor_sb.st_ino)
+                   Editor = estrdup(Editor);
                    break;
            }
        } while ((Editor = strtok(NULL, ":")));
Comment 1 Henrik Ahlgren 2002-04-03 07:40:59 MST
Ooops, embarrassing, this is already fixed in 1.6.5.