Bug 633

Summary: Crash running with close-from option
Product: Sudo Reporter: Natrio <natrio>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.8.9   
Hardware: PC   
OS: Linux   
Attachments: Fix for ecalloc(0) failure with -C option.
Better fix for ecalloc(0) failure with -C option.

Description Natrio 2014-02-04 00:10:39 MST
sudo-1.8.9p4 crashes with option -C , if closefrom_override enabled in sudoers:
Defaults:root   closefrom_override

# sudo -C 9 -u user /usr/bin/command
sudo: internal error, tried to ecalloc(0)

sudo-1.8.8 works normally.

Tested on latest Arch Linux, builds i686 and armv7h
Comment 1 Natrio 2014-02-04 01:17:55 MST
UPD:
sudo-1.8.9p3 works too.
Comment 2 Natrio 2014-02-04 01:48:12 MST
UPD:
sudo-1.8.10b1 crashes.
The bug is between 1.8.9p3 and 1.8.9p4 versions.
Comment 3 Todd C. Miller 2014-02-04 05:48:33 MST
Created attachment 395 [details]
Fix for ecalloc(0) failure with -C option.

I've attached a trivial fix.  I need to do a bit more checking to make sure something more complicated is not needed.
Comment 4 Natrio 2014-02-04 06:01:27 MST
It works for me, thanks!
Comment 5 Todd C. Miller 2014-02-04 06:25:40 MST
Created attachment 396 [details]
Better fix for ecalloc(0) failure with -C option.

Updated fix with what I just checked in to the source tree.
Comment 6 Natrio 2014-02-04 06:36:13 MST
It works.
Is it final patch?
Comment 7 Todd C. Miller 2014-02-04 06:40:13 MST
Yes, sudo 1.8.9p5 will be released today with that patch.
Comment 8 Natrio 2014-02-04 06:42:47 MST
Thank you!
Comment 9 Todd C. Miller 2014-02-04 10:24:00 MST
Fixed in sudo 1.8.9p5, available now.