Bug 75

Summary: visudo fails if $EDITOR set
Product: Sudo Reporter: Henrik Ahlgren <pablo>
Component: VisudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.6.4   
Hardware: All   
OS: All   

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.