VirtualBox

Ignore:
Timestamp:
Jul 12, 2016 9:02:41 AM (8 years ago)
Author:
vboxsync
Message:

ValidationKit/txsclient.py: Convert string read from the stdin object to an array or it will get zero terminated by TransportBase.sendMsg corrupting the data to send

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/txsclient.py

    r62159 r62179  
    750750                   and not isinstance(oStdIn, basestring):
    751751                    try:
    752                         abInput = oStdIn.read(65536);
     752                        sInput = oStdIn.read(65536);
    753753                    except:
    754754                        reporter.errorXcpt('read standard in');
     
    756756                        rc = None;
    757757                        break;
    758                     if len(abInput) > 0:
    759                         oStdIn.uTxsClientCrc32 = zlib.crc32(abInput, oStdIn.uTxsClientCrc32);
     758                    if len(sInput) > 0:
     759                        oStdIn.uTxsClientCrc32 = zlib.crc32(sInput, oStdIn.uTxsClientCrc32);
     760                        # Convert to a byte array before handing it of to sendMsg or the string
     761                        # will get some zero termination added breaking the CRC (and injecting
     762                        # unwanted bytes).
     763                        abInput = array.array('B', sInput);
    760764                        rc = self.sendMsg('STDIN', (long(oStdIn.uTxsClientCrc32 & 0xffffffff), abInput));
    761765                        if rc is not True:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette