|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31684 dio_tcsetattr implementation leads to misconfigured termios settings
Submitted: 2005-01-25 04:38 UTC Modified: 2005-01-25 14:43 UTC
From: elod at itfais dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.3.10 OS: MacOSX 10.3.7
Private report: No CVE-ID: None
 [2005-01-25 04:38 UTC] elod at itfais dot com
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 

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

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-25 14:43 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 23:01:29 2024 UTC