Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent panic on malformed auth data #557

Merged
Prev Previous commit
Next Next commit
Return real mysql err
  • Loading branch information
timvaillancourt committed Mar 29, 2021
commit 1a5adb6f74bbb4da2299653f5548fd923d4f1611
2 changes: 1 addition & 1 deletion server/handshake_resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (c *Conn) readPluginName(data []byte, pos int) int {
func (c *Conn) readAuthData(data []byte, pos int) ([]byte, int, int, error) {
// prevent 'panic: runtime error: index out of range' error
if pos > len(data)-1 {
return nil, 0, 0, errors.New("bad handshake")
return nil, 0, 0, NewDefaultError(ER_HANDSHAKE_ERROR)
}

// length encoded data
Expand Down