[ https://issues.apache.org/jira/browse/GEODE-10095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17924686#comment-17924686 ]
ASF GitHub Bot commented on GEODE-10095: ---------------------------------------- mreddington closed pull request #937: GEODE-10095: Removed null terminator... thing... from vector. URL: https://github.com/apache/geode-native/pull/937 > 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 > Assignee: Matthew Reddington > Priority: Major > > 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.10#820010)