From:             elod at itfais dot com
Operating system: MacOSX 10.3.7
PHP version:      4.3.10
PHP Bug Type:     Filesystem function related
Bug description:  dio_tcsetattr implementation leads to misconfigured termios 
settings

Description:
------------
The implementation of dio_tcsetattr misuses the 
tcsetattr() function call for setting termios parameters 
on a descriptor.  It fills an uninitialized stack local 
termios structure with parameters gleened from input to 
the dio_tcsetattr() function call while leaving all 
other paramters uninitialized.  This can (and does) lead 
to unpredictable behavior on the device when default 
settings are overwritten with garbage.  

The correct way to set termio structure information is 
to first _get_ the current termios settings 
(tcgetattr) on the device, then modifying only the flags 
necessary, and then setting the modified termios with 
tcsetattr().

Following is a diff of ext/dio.c between the 
distribution version and my modified (and fixed) 
version:

598a599,600
>       memset(&newtio, 0, sizeof(newtio));
>       tcgetattr(f->fd, &newtio);


-- 
Edit bug report at http://bugs.php.net/?id=31684&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31684&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31684&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31684&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31684&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31684&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31684&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31684&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31684&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31684&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31684&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31684&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31684&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31684&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31684&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31684&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31684&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31684&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31684&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31684&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31684&r=mysqlcfg

Reply via email to