[BusyBox 0000600]: less segfaults if controlling terminal cannot be open

bugs at busybox.net bugs at busybox.net
Fri Dec 16 08:02:24 UTC 2005


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=600 
====================================================================== 
Reported By:                iggarpe
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   600
Category:                   Other
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             12-15-2005 03:27 PST
Last Modified:              12-16-2005 00:02 PST
====================================================================== 
Summary:                    less segfaults if controlling terminal cannot be
open
Description: 
If the controlling terminal cannot be open, less segfaults. Not being able
to open the controlling terminal is certainly an error condition by
itself, but less should at least print an error message and exit
gracefully instead of segfaulting.

The cause is that there is no error check in the open(CURRENT_TTY) call,
which later leads to fileno(inp) segfault since inp == NULL.

Attached patch checks inp == NULL after the open call, prints an error,
and dies.
====================================================================== 

---------------------------------------------------------------------- 
 vodz - 12-15-05 03:55  
---------------------------------------------------------------------- 
Ok. I change fopen() to bb_xfopen() for this. 

---------------------------------------------------------------------- 
 landley - 12-16-05 00:02  
---------------------------------------------------------------------- 
svn 12923 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
12-15-05 03:27  iggarpe        New Issue                                    
12-15-05 03:27  iggarpe        Status                   new => assigned     
12-15-05 03:27  iggarpe        Assigned To               => BusyBox         
12-15-05 03:27  iggarpe        File Added: less.diff                        
12-15-05 03:55  vodz           Note Added: 0000785                          
12-16-05 00:02  landley        Status                   assigned => closed  
12-16-05 00:02  landley        Note Added: 0000787                          
======================================================================




More information about the busybox-cvs mailing list