Blake Bender created GEODE-10095:
------------------------------------
Summary: TcrConnection::readHandshakeData reads too many bytes
Key: GEODE-10095
URL: https://issues.apache.org/jira/browse/GEODE-10095
Project: Geode
Issue Type: Bug
Components: native client
Reporter: Blake Bender
This method is called to read bytes from a socket, and return said data in a
`std::vector<int8_t>`. For some inexplicable (inexcusable?) reason, the method
always adds a 0 byte to the end of the vector, as if it were null-terminating a
string. So, `readHandshakeData(1)` returns 2 bytes, `readHandshakeData(5)`
returns 6 bytes, etc.
This is extremely misleading, given the name of the method and the fact that
the requested number of bytes is a parameter passed in. Also, in no
circumstance is this method used to actually read a string, i.e. something that
may require null-termination. Please remove the extra byte from the returned
vector, and if possible add a unit test to the suite that reads _n_ bytes and
asserts that the method always returns _n_ bytes.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)