Bug 45168

Summary: Buffer overflow in /usr/bin/dialog
Product: Base System Reporter: SaturNero <saturnero>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: dave
Priority: Normal    
Version: 4.7-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
packages.sh none

Description SaturNero 2002-11-09 19:00:05 UTC
	/usr/bin/dialog exits with Segmentation fault (after the Ok) when handling
    long checklists with many "on" field.
    Bug found by dave@freesbie.org and saturnero@freesbie.org

How-To-Repeat: 	The attached file packages.sh is a sample shell script that faults after
    the Ok
Comment 1 daveb 2002-11-13 22:58:18 UTC
The result from a checklist is stored in the result variable, with a
maximum length of MAX_LEN, which is defined in /usr/include/dialog.h
or /usr/src/gnu/lib/libdialog/dialog.h as 2048. Your checklist's
output is breaching this limit.

Could the result variable perhaps be dynamically allocated to hold as
much as argv does? I'm not too familiar with dialog, but does it ever
output more than it receives as input?

--
Dave
Comment 2 Nate Eldredge 2005-10-13 22:29:43 UTC
libdialog appears to be brimming with bugs of this sort.  Lots of uses of 
strcpy / strcat.  It probably needs a complete audit.  Ideally there 
should be no MAX_LEN and everything dynamically allocated.  I hope to god 
it is never run by anything with elevated privileges.

-- 
Nate Eldredge
nge@cs.hmc.edu
Comment 3 Andrey A. Chernov freebsd_committer freebsd_triage 2008-05-25 14:00:15 UTC
State Changed
From-To: open->patched

MAX_LEN bumped to 4096
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2011-02-24 13:10:32 UTC
State Changed
From-To: patched->closed

dialog has been updated