bjarnoldus / mac-osx-pl2303

PL2303 USB to Serial Driver for Mac OS X
www.mac-usb-serial.com
GNU General Public License v2.0
108 stars 35 forks source link

Device name not null terminated #3

Closed y3ddet closed 9 years ago

y3ddet commented 10 years ago

In Driver_PL2303.cpp Line 1119:

    unsigned char       rname[10];

The array is not guaranteed to be null, nor is bzero() called. If the createSuffix() call at line 1150 uses the entire length of the buffer for the device serial number value then the strncpy() will leave a not-null terminated buffer. Below that call the value is used by setProperty() at line 1152:

fNub->setProperty( kIOTTYSuffixKey, suffix ) 

The incorrectly terminated string will result in a malformed property string, potentially a security issue, kernel panic, and makes the driver fail to generate /dev/tty.xxx entries.

Proposed fix

Add the following at line 1151:

bzero(rname,10)
bjarnoldus commented 9 years ago

Thanks for the comment.