Fix and test out of range#1166
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds validation to ensure that NUL-terminated strings (username, database name, and auth plugin name) in the handshake response are properly terminated, returning an error if they are not. It also updates the corresponding tests. The reviewer recommended adding bounds checks (pos > len(data)) to prevent potential out-of-bounds panics, reusing the calculated index idx to avoid redundant bytes.IndexByte and len calls, and removing a duplicate test case in the test suite.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
7c19935 to
0caa5a6
Compare
When sending a pluginname, username without a null termination it panics like panic: runtime error: slice bounds out of range [58:57]
0caa5a6 to
66e959e
Compare
When sending a pluginname, username without a null termination it panics like panic: runtime error: slice bounds out of range [58:57]
When sending a pluginname, username without a null termination it panics like
panic: runtime error: slice bounds out of range [58:57]