Bug 670 - Segfault when sudo -i run from non-existent directory
Segfault when sudo -i run from non-existent directory
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.11
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-07 09:13 MDT by rmull
Modified: 2014-10-08 02:34 MDT (History)
0 users

See Also:


Attachments
Fix for crash when current working directory cannot be determined (778 bytes, patch)
2014-10-07 12:25 MDT, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rmull 2014-10-07 09:13:26 MDT
Hello,

I can reproduce a segfault with sudo, version:

Sudo version 1.8.11
Sudoers policy plugin version 1.8.11
Sudoers file grammar version 43
Sudoers I/O plugin version 1.8.11

configure options:

./configure --prefix=/usr --libexecdir=/usr/lib --mandir=/usr/man --with-logfac=auth --with-vardir=/var/lib/sudo --with-rundir=/var/run/sudo --without-pam --disable-nls --disable-shadow

Steps to reproduce:

As user:

mkdir ~/test
cd ~/test
rm -rf ../test
sudo -i

Output:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Segmentation fault


Let me know if there is anything else I can provide
Comment 1 Todd C. Miller 2014-10-07 12:25:13 MDT
Created attachment 432 [details]
Fix for crash when current working directory cannot be determined
Comment 2 rmull 2014-10-07 13:33:32 MDT
(In reply to Todd C Miller from comment #1)
> Created attachment 432 [details]
> Fix for crash when current working directory cannot be determined

Patch fixes the segfault for me. sudo -i prints the same shell-init and chdir messages, but instead of a segfault I get the root prompt and my cwd is /root.

Thanks for the quick turnaround.
Comment 3 Todd C. Miller 2014-10-08 02:34:52 MDT
Fixed in sudo 1.8.11p1, available now.