Bug 342

Summary: segmentation fault when /etc/sudoers has wrong perms (among others)
Product: Sudo Reporter: Stefan Huber <shuber2>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal CC: jimsowa
Priority: normal    
Version: 1.7.0   
Hardware: PC   
OS: Linux   
Attachments: Simple patch: remove the NO_EXIT flags.

Description Stefan Huber 2009-03-07 12:17:18 MST
When /etc/sudoers has wrong permissions then a 'sudo bla' answers
  sudo: /etc/sudoers is mode 0442, should be 0440
  Segmentation fault


The bug is at sudo.c:1089, where fileno is called with fp, even though fp is NULL. This is not only the case for wrong perms for /etc/sudoers but rather for any other error related to /etc/sudoers.

Checked if the bug is also present in latetest webCVS version, and it is.
Comment 1 Stefan Huber 2009-03-07 12:28:12 MST
Created attachment 249 [details]
Simple patch: remove the NO_EXIT flags.
Comment 2 Todd C. Miller 2009-03-07 16:57:43 MST
This has been fixed for some time in cvs:

revision 1.501
date: 2009/01/09 00:13:37;  author: millert;  state: Exp;  lines: +9 -7
Do not try to set the close on exec flag if we didn't actually open sudoers.
Comment 3 Stefan Huber 2009-03-07 17:15:40 MST
Ah, right, the bug is fixed already. I was reading too inaccurately.
Comment 4 Todd C. Miller 2009-03-12 10:08:43 MDT
Fixed in sudo 1.7.1.  A beta version of sudo 1.7.1 may be downloaded from http://www.sudo.ws/devel.html
Comment 5 Todd C. Miller 2009-11-17 10:15:28 MST
*** Bug 374 has been marked as a duplicate of this bug. ***