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

bugs at busybox.net bugs at busybox.net
Thu Dec 15 11:56:08 UTC 2005


A NOTE has been added to this issue. 
====================================================================== 
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:                     assigned
====================================================================== 
Date Submitted:             12-15-2005 03:27 PST
Last Modified:              12-15-2005 03:55 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. 

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                          
======================================================================




More information about the busybox-cvs mailing list