Skip to content

fix server response packet decoding for empty password duing connecti… #430

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

Merged
merged 1 commit into from
Sep 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions server/handshake_resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,16 @@ func (c *Conn) readAuthData(data []byte, pos int) ([]byte, int, int, error) {
}
auth = authData
authLen = readBytes
} else {
} else if c.capability&CLIENT_SECURE_CONNECTION != 0 {
//auth length and auth
authLen = int(data[pos])
pos++
auth = data[pos : pos+authLen]
if authLen == 0 {
// skip the next \NUL in case the password is empty
pos++
}
} else {
authLen = bytes.IndexByte(data[pos:], 0x00)
auth = data[pos : pos+authLen]
// account for last NUL
authLen++
}
return auth, authLen, pos, nil
}
Expand Down