Skip to content
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
6 changes: 4 additions & 2 deletions app/xshell.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ func xshellHandshake(conn net.Conn, cookie string) error {
if int(initMsg.Length) != len(cookie) {
return fmt.Errorf("xagent: invalid cookie length")
}
if int(initMsg.Length) < len(initMsg.Cookie) {
return fmt.Errorf("xagent: invalid message length")
// Newer XShell (8) may append extra data (e.g. a key name) after the cookie
// in the handshake frame; keep only the first Length bytes.
if len(initMsg.Cookie) > int(initMsg.Length) {
initMsg.Cookie = initMsg.Cookie[:initMsg.Length]
}

cookieRemain := make([]byte, int(initMsg.Length)-len(initMsg.Cookie))
Expand Down
Loading